Skip to content

Commit 7482867

Browse files
ci: enable gocritic in golangci (#1223)
1 parent 96598cc commit 7482867

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
linters:
2+
enable:
3+
- gocritic

app/app.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,7 @@ func (c colimaApp) Version() error {
407407

408408
var kube environment.Container
409409
for _, cont := range containerRuntimes {
410-
switch cont.Name() {
411-
case kubernetes.Name:
410+
if cont.Name() == kubernetes.Name {
412411
kube = cont
413412
continue
414413
}

environment/container/docker/daemon.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func (d dockerRuntime) createDaemonFile(conf map[string]any, env map[string]stri
5858
return err
5959
}
6060
if vars.http != "" {
61-
proxyConf["http-proxy"] = strings.Replace(vars.http, "127.0.0.1", hostGatewayIP, -1)
61+
proxyConf["http-proxy"] = strings.ReplaceAll(vars.http, "127.0.0.1", hostGatewayIP)
6262
}
6363
if vars.https != "" {
64-
proxyConf["https-proxy"] = strings.Replace(vars.https, "127.0.0.1", hostGatewayIP, -1)
64+
proxyConf["https-proxy"] = strings.ReplaceAll(vars.https, "127.0.0.1", hostGatewayIP)
6565
}
6666
if vars.no != "" {
67-
proxyConf["no-proxy"] = strings.Replace(vars.no, "127.0.0.1", hostGatewayIP, -1)
67+
proxyConf["no-proxy"] = strings.ReplaceAll(vars.no, "127.0.0.1", hostGatewayIP)
6868
}
6969
conf["proxies"] = proxyConf
7070
}

environment/container/kubernetes/kubernetes.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ func (c kubernetesRuntime) Teardown(ctx context.Context) error {
246246

247247
// k3s is buggy with external containerd for now
248248
// cleanup is manual
249-
a.Add(func() error {
250-
return c.deleteAllContainers()
251-
})
249+
a.Add(c.deleteAllContainers)
252250

253251
c.teardownKubeconfig(a)
254252

util/terminal/output.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (v *verboseWriter) refresh() error {
6666
}
6767

6868
func (v *verboseWriter) addLine() {
69-
defer v.buf.Truncate(0)
69+
defer v.buf.Reset()
7070

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

0 commit comments

Comments
 (0)