From 42776b6133f7ead7511c32900b5b26316eaf718f Mon Sep 17 00:00:00 2001 From: Alexander Apalikov Date: Fri, 4 Sep 2020 01:33:22 +0300 Subject: [PATCH] GolangCI-lint updating version to 1.30 (#1785) Add exportloopref which is a successor of obsoleted scopelint. Disable unnecessaryDefer which are located right before return. Co-authored-by: Mark Mandel --- .golangci.yml | 2 ++ build/build-image/Dockerfile | 2 +- cmd/controller/main.go | 4 ++-- test/e2e/framework/framework.go | 2 +- test/load/allocation/allocationload.go | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b8f7767a52..eb2c28813e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,6 +46,7 @@ output: linters: enable: + - exportloopref - deadcode - megacheck - govet @@ -77,6 +78,7 @@ linters-settings: disabled-checks: - paramTypeCombine - unnamedResult + - unnecessaryDefer settings: # settings passed to gocritic hugeParam: sizeThreshold: 512 diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index 171b55715c..8a83aabfdb 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -68,7 +68,7 @@ RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \ RUN echo "source <(helm completion bash)" >> /root/.bashrc # install golang-ci linter -RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.27.0 +RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.30.0 # # \ \ / /__| |__ ___(_) |_ ___ diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 84135de06e..e19622c4f1 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -247,8 +247,8 @@ func parseEnvFlags() config { viper.SetDefault(sidecarMemoryLimitFlag, "0") viper.SetDefault(pullSidecarFlag, false) viper.SetDefault(sdkServerAccountFlag, "agones-sdk") - viper.SetDefault(certFileFlag, filepath.Join(base, "certs/server.crt")) - viper.SetDefault(keyFileFlag, filepath.Join(base, "certs/server.key")) + viper.SetDefault(certFileFlag, filepath.Join(base, "certs", "server.crt")) + viper.SetDefault(keyFileFlag, filepath.Join(base, "certs", "server.key")) viper.SetDefault(enablePrometheusMetricsFlag, true) viper.SetDefault(enableStackdriverMetricsFlag, false) viper.SetDefault(stackdriverLabels, "") diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index d8fc372c9d..a043fc2ff5 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -152,7 +152,7 @@ func NewFromFlags() (*Framework, error) { return nil, err } - viper.SetDefault(kubeconfigFlag, filepath.Join(usr.HomeDir, "/.kube/config")) + viper.SetDefault(kubeconfigFlag, filepath.Join(usr.HomeDir, ".kube", "config")) viper.SetDefault(gsimageFlag, "gcr.io/agones-images/udp-server:0.21") viper.SetDefault(pullSecretFlag, "") viper.SetDefault(stressTestLevelFlag, 0) diff --git a/test/load/allocation/allocationload.go b/test/load/allocation/allocationload.go index b974d5a2ae..b927a7bda5 100644 --- a/test/load/allocation/allocationload.go +++ b/test/load/allocation/allocationload.go @@ -35,7 +35,7 @@ func main() { if err != nil { logrus.Fatalf("Unable to determine the current user: %v", err) } - kubeconfig := flag.String("kubeconfig", filepath.Join(usr.HomeDir, "/.kube/config"), + kubeconfig := flag.String("kubeconfig", filepath.Join(usr.HomeDir, ".kube", "config"), "kube config path, e.g. $HOME/.kube/config") fleetName := flag.String("fleet_name", "simple-udp", "The fleet name that the tests will run against") qps := flag.Int("qps", 1000, "The QPS value that will overwrite the default value")