From 36bd6720dd56f6072ad8ddba3cebc2f319edef5b Mon Sep 17 00:00:00 2001 From: Andras Jaky Date: Tue, 9 Aug 2022 17:52:59 +0200 Subject: [PATCH] feat: added "linux" string as const - because it has at least 3 occurrences in the package and the linter wanted to --- internal/cli/command/controlplane/init.go | 2 +- internal/cli/command/controlplane/kind.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cli/command/controlplane/init.go b/internal/cli/command/controlplane/init.go index 2243a83e..e6662ede 100644 --- a/internal/cli/command/controlplane/init.go +++ b/internal/cli/command/controlplane/init.go @@ -205,7 +205,7 @@ func runInit(options initOptions, banzaiCli cli.Cli) error { } k8sContext = "" log.Debugf("won't use local kubernetes context: %v", err) - } else if runtime.GOOS != "linux" { + } else if runtime.GOOS != linuxGOOS { // non-native docker daemons can't access the host machine directly even if running in host networking mode // we have to rewrite configs referring to localhost to use the special name `host.docker.internal` instead k8sConfig, err = input.RewriteLocalhostToHostDockerInternal(k8sConfig) diff --git a/internal/cli/command/controlplane/kind.go b/internal/cli/command/controlplane/kind.go index e37d32a9..7713aeea 100644 --- a/internal/cli/command/controlplane/kind.go +++ b/internal/cli/command/controlplane/kind.go @@ -41,6 +41,7 @@ import ( const version = "v0.9.0" const clusterName = "banzai" const kindCmd = "kind" +const linuxGOOS = "linux" func isKINDInstalled(banzaiCli cli.Cli) bool { path, err := findKINDPath(banzaiCli) @@ -181,7 +182,7 @@ func ensureKINDCluster(banzaiCli cli.Cli, options *cpContext, listenAddress stri return errors.WrapIf(err, "failed to get KIND kubeconfig") } - if runtime.GOOS != "linux" { + if runtime.GOOS != linuxGOOS { // non-native docker daemons can't access the host machine directly even if running in host networking mode // we have to rewrite configs referring to localhost to use the special name `host.docker.internal` instead _, err = input.RewriteLocalhostToHostDockerInternal(kubeconfig) @@ -190,7 +191,7 @@ func ensureKINDCluster(banzaiCli cli.Cli, options *cpContext, listenAddress stri } } - if runtime.GOOS == "darwin" || runtime.GOOS == "linux" { + if runtime.GOOS == "darwin" || runtime.GOOS == linuxGOOS { err = fixKind0_9_0KubeProxy(kubeconfig) if err != nil { return errors.Wrap(err, "failed to fix Kind v0.9.0 kube-proxy CrashLoopBackoff")