Skip to content

Commit

Permalink
lint: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall committed Sep 29, 2024
1 parent 1511c5e commit 54c663f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libbeat/common/schema/mapstrstr/mapstrstr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package mapstrstr

import (
"errors"
"testing"
"time"

Expand Down Expand Up @@ -126,7 +127,8 @@ func TestKeyInErrors(t *testing.T) {
_, errs := c.Schema.ApplyTo(mapstr.M{}, c.Input)
assert.NotEmpty(t, errs, c.Description)
if assert.Equal(t, 1, len(errs), c.Description) {
keyErr, ok := errs[0].(s.KeyError)
var keyErr s.KeyError
ok := errors.As(errs[0], &keyErr)
if assert.True(t, ok, c.Description) {
assert.Equal(t, c.Expected, keyErr.Key(), c.Description)
}
Expand Down
1 change: 1 addition & 0 deletions winlogbeat/module/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func applyTemplates(prefix string, version string, filename string, original []b
if err != nil {
return nil, fmt.Errorf("failed to sanitize the YAML pipeline file: %s: %w", filename, err)
}
//nolint:errcheck // ignore
content = newContent.(map[string]interface{})
default:
return nil, fmt.Errorf("unsupported extension '%s' for pipeline file: %s", extension, filename)
Expand Down
1 change: 1 addition & 0 deletions x-pack/auditbeat/module/system/socket/helper/loopback.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (lo *IPv6Loopback) AddRandomAddress() (addr net.IP, err error) {
if err = unix.Bind(fd, &bindAddr); err == nil {
break
}
//nolint:errcheck // ignore

Check failure on line 111 in x-pack/auditbeat/module/system/socket/helper/loopback.go

View workflow job for this annotation

GitHub Actions / lint (linux)

directive `//nolint:errcheck // ignore` is unused for linter "errcheck" (nolintlint)
if errno, ok := err.(unix.Errno); !ok || errno != unix.EADDRNOTAVAIL {

Check failure on line 112 in x-pack/auditbeat/module/system/socket/helper/loopback.go

View workflow job for this annotation

GitHub Actions / lint (linux)

type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
break
}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/auditbeat/module/system/socket/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ func (dt *dnsTracker) AddTransaction(tr dns.Transaction) {
}
var list []dns.Transaction
if prev := dt.transactionByClient.Get(clientAddr); prev != nil {
//nolint:errorlint // ignore

Check failure on line 311 in x-pack/auditbeat/module/system/socket/state.go

View workflow job for this annotation

GitHub Actions / lint (linux)

directive `//nolint:errorlint // ignore` is unused for linter "errorlint" (nolintlint)
list = prev.([]dns.Transaction)

Check failure on line 312 in x-pack/auditbeat/module/system/socket/state.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value is not checked (errcheck)
}
list = append(list, tr)
Expand All @@ -331,6 +332,7 @@ func (dt *dnsTracker) RegisterEndpoint(addr net.UDPAddr, proc *process) {
key := addr.String()
dt.processByClient.Put(key, proc)
if listIf := dt.transactionByClient.Get(key); listIf != nil {
//nolint:errorlint // ignore

Check failure on line 335 in x-pack/auditbeat/module/system/socket/state.go

View workflow job for this annotation

GitHub Actions / lint (linux)

directive `//nolint:errorlint // ignore` is unused for linter "errorlint" (nolintlint)
list := listIf.([]dns.Transaction)

Check failure on line 336 in x-pack/auditbeat/module/system/socket/state.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value is not checked (errcheck)
for _, tr := range list {
proc.addTransaction(tr)
Expand Down
1 change: 1 addition & 0 deletions x-pack/libbeat/management/managerV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ func (cm *BeatV2Manager) reload(units map[unitKey]*agentUnit) {
// reloadInputs wraps the multierror so we have to call Unwrap
wr := errors.Unwrap(err)

//nolint:errcheck // ignore

Check failure on line 687 in x-pack/libbeat/management/managerV2.go

View workflow job for this annotation

GitHub Actions / lint (linux)

directive `//nolint:errcheck // ignore` is unused for linter "errcheck" (nolintlint)
if u, ok := wr.(interface {

Check failure on line 688 in x-pack/libbeat/management/managerV2.go

View workflow job for this annotation

GitHub Actions / lint (linux)

type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
Unwrap() []error
}); ok {
Expand Down

0 comments on commit 54c663f

Please sign in to comment.