Skip to content

Commit

Permalink
golangci.yml: silence invalid linter complaints on use of logp.Testin…
Browse files Browse the repository at this point in the history
…gSetup (#36474)

A logp.TestingSetup call can only fail when no logp.ToObserverOutput()
option has been provided and one of syslog, file or event log output has
been selected. There is no case in the code base where this is true.
So disable the errcheck linter for this function.

The only way that the function can return an error is when a user makes
use of a custom logp.Option function since none of the provided Options
alter the logp.Config to cause output to failable destinations.
  • Loading branch information
efd6 authored Aug 31, 2023
1 parent eef9598 commit ac5f806
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ linters-settings:
exclude-functions:
- (github.com/elastic/elastic-agent-libs/mapstr.M).Delete # Only returns ErrKeyNotFound, can safely be ignored.
- (github.com/elastic/elastic-agent-libs/mapstr.M).Put # Can only fail on type conversions, usually safe to ignore.
- (github.com/elastic/elastic-agent-libs/logp).TestingSetup # Cannot return a non-nil error using the provided API.

errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
Expand Down

0 comments on commit ac5f806

Please sign in to comment.