Skip to content

Commit

Permalink
feat: added "linux" string as const
Browse files Browse the repository at this point in the history
- because it has at least 3 occurrences in the package and the linter wanted to
  • Loading branch information
akijakya committed Aug 9, 2022
1 parent 2702884 commit 36bd672
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/cli/command/controlplane/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/command/controlplane/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit 36bd672

Please sign in to comment.