Skip to content

Commit

Permalink
golangci-lint: Enable loggercheck linter (#535)
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <[email protected]>
  • Loading branch information
aknuds1 authored Jun 19, 2024
1 parent 4beef46 commit 6e74a2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ linters:
- gofmt
- misspell
- revive
- loggercheck

linters-settings:
errcheck:
Expand Down
2 changes: 1 addition & 1 deletion grpcutil/dns_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (w *dnsWatcher) lookupSRV() map[string]*Update {
for _, a := range addrs {
a, ok := formatIP(a)
if !ok {
level.Error(w.logger).Log("failed IP parsing", "err", err)
level.Error(w.logger).Log("msg", "failed IP parsing", "err", err)
continue
}
addr := a + ":" + strconv.Itoa(int(s.Port))
Expand Down
3 changes: 3 additions & 0 deletions log/buffered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ func TestOnFlushCallback(t *testing.T) {
)

l := log.NewLogfmtLogger(bufLog)
//nolint: loggercheck
require.NoError(t, l.Log("line"))
//nolint: loggercheck
require.NoError(t, l.Log("line"))
// first flush
//nolint: loggercheck
require.NoError(t, l.Log("line"))

// pre-condition check: the last Log() call should have flushed previous entries.
Expand Down

0 comments on commit 6e74a2e

Please sign in to comment.