Skip to content

miss makezero in slice init #3600

Open
Open
@alingse

Description

@alingse

Checklist:

  • I've included steps to reproduce the bug.
  • I've included the version of argo rollouts.

Describe the bug

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/9242996808/job/25426547885

====================================================================================================
append to slice `oneOf` with non-zero initialized length at https://github.com/argoproj/argo-rollouts/blob/master/pkg/apis/rollouts/validation/validation.go#L486:10
append to slice `oneOf` with non-zero initialized length at https://github.com/argoproj/argo-rollouts/blob/master/pkg/apis/rollouts/validation/validation.go#L487:10
append to slice `oneOf` with non-zero initialized length at https://github.com/argoproj/argo-rollouts/blob/master/pkg/apis/rollouts/validation/validation.go#L488:10
append to slice `oneOf` with non-zero initialized length at https://github.com/argoproj/argo-rollouts/blob/master/pkg/apis/rollouts/validation/validation.go#L48[9](https://github.com/alingse/go-linter-runner/actions/runs/9242996808/job/25426547885#step:4:10):10
====================================================================================================
	oneOf := make([]bool, 3)
	oneOf = append(oneOf, s.SetWeight != nil)
	oneOf = append(oneOf, s.Pause != nil)
	oneOf = append(oneOf, s.Experiment != nil)
	oneOf = append(oneOf, s.Analysis != nil)

shoud be

	oneOf := make([]bool, 0, 4)
	oneOf = append(oneOf, s.SetWeight != nil)
	oneOf = append(oneOf, s.Pause != nil)
	oneOf = append(oneOf, s.Experiment != nil)
	oneOf = append(oneOf, s.Analysis != nil)

To Reproduce

Expected behavior

Screenshots

Version

Logs

# Paste the logs from the rollout controller

# Logs for the entire controller:
kubectl logs -n argo-rollouts deployment/argo-rollouts

# Logs for a specific rollout:
kubectl logs -n argo-rollouts deployment/argo-rollouts | grep rollout=<ROLLOUTNAME

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions