Merge pull request #11150 from medyagh/golang_ci_bump

bump golangci-lint to latest v1.39.0
pull/11080/head
Medya Ghazizadeh 2021-04-19 16:21:59 -07:00 committed by GitHub
commit 85443b65e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 47 additions and 47 deletions

View File

@ -68,7 +68,7 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download
KERNEL_VERSION ?= 4.19.171
# latest from https://github.com/golangci/golangci-lint/releases
GOLINT_VERSION ?= v1.30.0
GOLINT_VERSION ?= v1.39.0
# Limit number of default jobs, to avoid the CI builds running out of memory
GOLINT_JOBS ?= 4
# see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint

View File

@ -140,7 +140,7 @@ var settings = []Setting{
},
{
name: Bootstrapper,
set: SetString, //TODO(r2d4): more validation here?
set: SetString,
},
{
name: config.ShowDriverDeprecationNotification,

View File

@ -133,7 +133,7 @@ func AskForPasswordValue(s string) string {
result, err := concealableAskForStaticValue(os.Stdin, s, true)
if err != nil {
log.Fatal(err)
defer log.Fatal(err)
}
return result
}

View File

@ -155,7 +155,7 @@ func Execute() {
if err := RootCmd.Execute(); err != nil {
// Cobra already outputs the error, typically because the user provided an unknown command.
os.Exit(reason.ExProgramUsage)
defer os.Exit(reason.ExProgramUsage)
}
}

View File

@ -44,6 +44,6 @@ func main() {
err = cmd.GenerateBashCompletion(f, cmd.RootCmd)
if err != nil {
fmt.Println(err)
os.Exit(1)
defer os.Exit(1)
}
}

View File

@ -186,9 +186,9 @@ func (k *Bootstrapper) init(cfg config.ClusterConfig) error {
}
ignore := []string{
fmt.Sprintf("DirAvailable-%s", strings.Replace(vmpath.GuestManifestsDir, "/", "-", -1)),
fmt.Sprintf("DirAvailable-%s", strings.Replace(vmpath.GuestPersistentDir, "/", "-", -1)),
fmt.Sprintf("DirAvailable-%s", strings.Replace(bsutil.EtcdDataDir(), "/", "-", -1)),
fmt.Sprintf("DirAvailable-%s", strings.ReplaceAll(vmpath.GuestManifestsDir, "/", "-")),
fmt.Sprintf("DirAvailable-%s", strings.ReplaceAll(vmpath.GuestPersistentDir, "/", "-")),
fmt.Sprintf("DirAvailable-%s", strings.ReplaceAll(bsutil.EtcdDataDir(), "/", "-")),
"FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml",
"FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml",
"FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml",

View File

@ -142,12 +142,12 @@ func MachinePath(machine string, miniHome ...string) string {
func SanitizeCacheDir(image string) string {
if runtime.GOOS == "windows" && hasWindowsDriveLetter(image) {
// not sanitize Windows drive letter.
s := image[:2] + strings.Replace(image[2:], ":", "_", -1)
s := image[:2] + strings.ReplaceAll(image[2:], ":", "_")
klog.Infof("windows sanitize: %s -> %s", image, s)
return s
}
// ParseReference cannot have a : in the directory path
return strings.Replace(image, ":", "_", -1)
return strings.ReplaceAll(image, ":", "_")
}
func hasWindowsDriveLetter(s string) bool {
@ -197,7 +197,7 @@ func getWindowsVolumeNameCmd(d string) (string, error) {
return "", err
}
outs := strings.Split(strings.Replace(string(stdout), "\r", "", -1), "\n")
outs := strings.Split(strings.ReplaceAll(string(stdout), "\r", ""), "\n")
var vname string
for _, l := range outs {

View File

@ -432,7 +432,7 @@ func setupKubeconfig(h *host.Host, cc *config.ClusterConfig, n *config.Node, clu
}
if cc.KubernetesConfig.APIServerName != constants.APIServerName {
addr = strings.Replace(addr, n.IP, cc.KubernetesConfig.APIServerName, -1)
addr = strings.ReplaceAll(addr, n.IP, cc.KubernetesConfig.APIServerName)
}
kcs := &kubeconfig.Settings{
ClusterName: clusterName,

View File

@ -386,9 +386,9 @@ func applyTmpl(format string, a ...V) string {
// escape any outstanding '%' signs so that they don't get interpreted
// as a formatting directive down the line
out = strings.Replace(out, "%", "%%", -1)
out = strings.ReplaceAll(out, "%", "%%")
// avoid doubling up in case this function is called multiple times
out = strings.Replace(out, "%%%%", "%%", -1)
out = strings.ReplaceAll(out, "%%%%", "%%")
return out
}

View File

@ -1444,7 +1444,7 @@ func validateCertSync(ctx context.Context, t *testing.T, profile string) {
}
// Strip carriage returned by ssh
got := strings.Replace(rr.Stdout.String(), "\r", "", -1)
got := strings.ReplaceAll(rr.Stdout.String(), "\r", "")
if diff := cmp.Diff(string(want), got); diff != "" {
t.Errorf("failed verify pem file. minikube_test.pem -> %s mismatch (-want +got):\n%s", vp, diff)
}

View File

@ -400,7 +400,7 @@ func PVCWait(ctx context.Context, t *testing.T, profile string, ns string, name
return wait.PollImmediate(1*time.Second, timeout, f)
}
//// VolumeSnapshotWait waits for volume snapshot to be ready to use
// VolumeSnapshotWait waits for volume snapshot to be ready to use
func VolumeSnapshotWait(ctx context.Context, t *testing.T, profile string, ns string, name string, timeout time.Duration) error {
t.Helper()

View File

@ -60,7 +60,7 @@ func installRelease(version string) (f *os.File, err error) {
// legacyStartArgs returns the arguments normally used for starting older versions of minikube
func legacyStartArgs() []string {
return strings.Split(strings.Replace(*startArgs, "--driver", "--vm-driver", -1), " ")
return strings.Split(strings.ReplaceAll(*startArgs, "--driver", "--vm-driver"), " ")
}
// TestRunningBinaryUpgrade upgrades a running legacy cluster to minikube at HEAD