Merge pull request #901 from sargun/upgrade-golint-to-v1.32.2

Upgrade to golangci-lint v1.32.2
This commit is contained in:
Sargun Dhillon
2020-11-06 17:07:48 -08:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ jobs:
command: V=1 CI=1 make vet
- run:
name: Install linters
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.17.1 && mv ./bin/* /go/bin/
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.32.2 && mv ./bin/* /go/bin/
- run:
name: Lint
command: golangci-lint run ./...

View File

@@ -24,13 +24,16 @@ func ClientsetFromEnv(kubeConfigPath string) (*kubernetes.Clientset, error) {
)
if kubeConfigPath != "" {
if _, err := os.Stat(kubeConfigPath); err != nil {
config, err = rest.InClusterConfig()
} else {
_, err = os.Stat(kubeConfigPath)
if err == nil {
config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeConfigPath},
&clientcmd.ConfigOverrides{},
).ClientConfig()
} else if os.IsNotExist(err) {
config, err = rest.InClusterConfig()
} else {
return nil, err
}
} else {
config, err = rest.InClusterConfig()