moncho / dry

dry - A Docker manager for the terminal @
http://moncho.github.io/dry/
MIT License
3.01k stars 100 forks source link

Bug Report: miss makezero in slice #229

Open alingse opened 6 months ago

alingse commented 6 months ago

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

see issues https://github.com/alingse/go-linter-runner/issues/1

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

====================================================================================================
append to slice `tasks` with non-zero initialized length at https://github.com/moncho/dry/blob/master/mocks/docker_swarmDaemon.go#L71:11
====================================================================================================
    tasks := make([]swarm.Task, len(services))
    for _, service := range services {
        tasks = append(tasks, swarm.Task{ServiceID: service, NodeID: TestNodeID})
    }

    return tasks, nil

should be update to tasks := make([]swarm.Task, 0, len(services))