koderover/zadig

[bug] miss makezero in slice init

Closed this issue · 1 comments

I was running github actions to run linter makezero for top github golang repos.

see issues alingse/go-linter-runner#1

and the github actions output https://github.com/alingse/go-linter-runner/actions/runs/9243002484/job/25426560007

====================================================================================================
append to slice `svcNames` with non-zero initialized length at https://github.com/koderover/zadig/blob/main/pkg/microservice/aslan/core/environment/service/environment_update.go#L514:15
====================================================================================================
		svcNames := make([]string, len(services))
		for _, svc := range services {
			svcNames = append(svcNames, svc.ServiceName)
		}
		serviceNames = svcNames

the svcNames := make([]string, len(services)) should be svcNames := make([]string, 0, len(services))

What happened?

What did you expect to happen?

How To Reproduce it(as minimally and precisely as possible)

Install Methods

  • Helm
  • Script base on K8s
  • All in One
  • Offline

Versions Used
zadig:

kubernetes:

Environment

Cloud Provider:

Resources:

OS:

Services Status

kubectl version
kubectl get po -n `zadig-installed-namespace`
# paste output here

If there is abnormal service, please provide service log

kubectl describe pods `abnormal-pod`
kubectl logs --tail=500 `abnormal-pod`
# paste output here

Thank you!