From 31c14fa2baee19027006888a122564b564095f36 Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Wed, 28 Jul 2021 15:52:17 -0700 Subject: [PATCH 1/3] chore: enable additional linters Signed-off-by: Anish Ramasekar --- .golangci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.golangci.yml b/.golangci.yml index 5c7862ff5..bd01e5c4d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,6 +20,7 @@ linters: - revive - staticcheck - structcheck + - typecheck - unconvert - unused - varcheck From 0e7d306e0fe85ed861672367977fc016939c8cc2 Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Wed, 28 Jul 2021 15:55:07 -0700 Subject: [PATCH 2/3] chore: enable errcheck linter and fix errors Signed-off-by: Anish Ramasekar --- .golangci.yml | 1 + cmd/proxy/main.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index bd01e5c4d..1394d9920 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,6 +5,7 @@ linters: disable-all: true enable: - deadcode + - errcheck - errorlint - goconst - gocyclo diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 62897c8ab..9cda9560d 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -57,7 +57,7 @@ func (p *proxy) writeResponse(w http.ResponseWriter, res *http.Response) { // Set a special header to notify that the proxy actually serviced the request. w.Header().Set("Server", "pi-sidecar-proxy") w.WriteHeader(res.StatusCode) - io.Copy(w, res.Body) + _, _ = io.Copy(w, res.Body) res.Body.Close() klog.InfoS("request complete", "status", res.StatusCode) From 54d68c525cbe12dca13b3e74295cdb4db75b7654 Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Wed, 28 Jul 2021 16:01:09 -0700 Subject: [PATCH 3/3] chore: enable whitespace linter and fix errors Signed-off-by: Anish Ramasekar --- .golangci.yml | 2 ++ cmd/webhook/main.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 1394d9920..0b6333297 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ linters: - ineffassign - misspell - nakedret + - nilerr - prealloc - revive - staticcheck @@ -25,5 +26,6 @@ linters: - unconvert - unused - varcheck + - whitespace # Run with --fast=false for more extensive checks fast: true diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 7036c831a..e4523350b 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -61,7 +61,6 @@ func init() { } func main() { - // TODO (aramase) once webhook is added as an arc extension, use extension // util to check if running in arc cluster. flag.BoolVar(&arcCluster, "arc-cluster", false, "Running on arc cluster")