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 command: V=1 CI=1 make vet
- run: - run:
name: Install linters 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: - run:
name: Lint name: Lint
command: golangci-lint run ./... command: golangci-lint run ./...

View File

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