From 87d3ee7554662b755bb5787faec966b1dda8d388 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 4 Sep 2023 10:40:11 +0200 Subject: [PATCH] Cleanup golangci-lint errcheck (#3502) Move the errcheck excludes list from an external file to inline in the golangci-lint config file. Signed-off-by: SuperQ --- .golangci.yml | 13 ++++++++++++- scripts/errcheck_excludes.txt | 13 ------------- 2 files changed, 12 insertions(+), 14 deletions(-) delete mode 100644 scripts/errcheck_excludes.txt diff --git a/.golangci.yml b/.golangci.yml index 168b1e5e..3ced4d92 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -30,7 +30,18 @@ linters-settings: - github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" - github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" errcheck: - exclude: scripts/errcheck_excludes.txt + exclude-functions: + # Don't flag lines such as "io.Copy(io.Discard, resp.Body)". + - io.Copy + # The next two are used in HTTP handlers, any error is handled by the server itself. + - io.WriteString + - (net/http.ResponseWriter).Write + # No need to check for errors on server's shutdown. + - (*net/http.Server).Shutdown + # Never check for logger errors. + - (github.com/go-kit/log.Logger).Log + # Never check for rollback errors as Rollback() is called when a previous error was detected. + - (github.com/prometheus/prometheus/storage.Appender).Rollback goimports: local-prefixes: github.com/prometheus/alertmanager gofumpt: diff --git a/scripts/errcheck_excludes.txt b/scripts/errcheck_excludes.txt deleted file mode 100644 index 8c77ca14..00000000 --- a/scripts/errcheck_excludes.txt +++ /dev/null @@ -1,13 +0,0 @@ -// Don't flag lines such as "io.Copy(io.Discard, resp.Body)". -io.Copy -// The next two are used in HTTP handlers, any error is handled by the server itself. -io.WriteString -(net/http.ResponseWriter).Write -// No need to check for errors on server's shutdown. -(*net/http.Server).Shutdown - -// Never check for logger errors. -(github.com/go-kit/log.Logger).Log - -// Never check for rollback errors as Rollback() is called when a previous error was detected. -(github.com/prometheus/prometheus/storage.Appender).Rollback