Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable gocritic in golangci #1223

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- gocritic
3 changes: 1 addition & 2 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -407,8 +407,7 @@ func (c colimaApp) Version() error {

var kube environment.Container
for _, cont := range containerRuntimes {
switch cont.Name() {
case kubernetes.Name:
if cont.Name() == kubernetes.Name {
kube = cont
continue
}
6 changes: 3 additions & 3 deletions environment/container/docker/daemon.go
Original file line number Diff line number Diff line change
@@ -58,13 +58,13 @@ func (d dockerRuntime) createDaemonFile(conf map[string]any, env map[string]stri
return err
}
if vars.http != "" {
proxyConf["http-proxy"] = strings.Replace(vars.http, "127.0.0.1", hostGatewayIP, -1)
proxyConf["http-proxy"] = strings.ReplaceAll(vars.http, "127.0.0.1", hostGatewayIP)
}
if vars.https != "" {
proxyConf["https-proxy"] = strings.Replace(vars.https, "127.0.0.1", hostGatewayIP, -1)
proxyConf["https-proxy"] = strings.ReplaceAll(vars.https, "127.0.0.1", hostGatewayIP)
}
if vars.no != "" {
proxyConf["no-proxy"] = strings.Replace(vars.no, "127.0.0.1", hostGatewayIP, -1)
proxyConf["no-proxy"] = strings.ReplaceAll(vars.no, "127.0.0.1", hostGatewayIP)
}
conf["proxies"] = proxyConf
}
4 changes: 1 addition & 3 deletions environment/container/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
@@ -246,9 +246,7 @@ func (c kubernetesRuntime) Teardown(ctx context.Context) error {

// k3s is buggy with external containerd for now
// cleanup is manual
a.Add(func() error {
return c.deleteAllContainers()
})
a.Add(c.deleteAllContainers)

c.teardownKubeconfig(a)

2 changes: 1 addition & 1 deletion util/terminal/output.go
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ func (v *verboseWriter) refresh() error {
}

func (v *verboseWriter) addLine() {
defer v.buf.Truncate(0)
defer v.buf.Reset()

// if height <=0, do not scroll
if v.lineHeight <= 0 {