mirror of https://github.com/docker/cli.git
linting: address slice-append issues found by gocritic
cli/command/trust/inspect.go:74:33: appendAssign: append result not assigned to the same slice (gocritic) signatureRows[idx].Signers = append(sig.Signers, releasedRoleName) ^ cli/command/task/print.go:92:7: appendAssign: append result not assigned to the same slice (gocritic) t := append(tasks[:0:0], tasks...) ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a2c9f3c6ce
commit
3f0c189e48
|
@ -89,7 +89,8 @@ func Print(ctx context.Context, dockerCli command.Cli, tasks []swarm.Task, resol
|
||||||
// Task-names are not unique in cases where "tasks" contains previous/rotated tasks.
|
// Task-names are not unique in cases where "tasks" contains previous/rotated tasks.
|
||||||
func generateTaskNames(ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver) ([]swarm.Task, error) {
|
func generateTaskNames(ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver) ([]swarm.Task, error) {
|
||||||
// Use a copy of the tasks list, to not modify the original slice
|
// Use a copy of the tasks list, to not modify the original slice
|
||||||
t := append(tasks[:0:0], tasks...)
|
// see https://github.com/go101/go101/wiki/How-to-efficiently-clone-a-slice%3F
|
||||||
|
t := append(tasks[:0:0], tasks...) //nolint:gocritic // ignore appendAssign: append result not assigned to the same slice
|
||||||
|
|
||||||
for i, task := range t {
|
for i, task := range t {
|
||||||
serviceName, err := resolver.Resolve(ctx, swarm.Service{}, task.ServiceID)
|
serviceName, err := resolver.Resolve(ctx, swarm.Service{}, task.ServiceID)
|
||||||
|
|
|
@ -71,7 +71,7 @@ func getRepoTrustInfo(cli command.Cli, remote string) ([]byte, error) {
|
||||||
// process the signatures to include repo admin if signed by the base targets role
|
// process the signatures to include repo admin if signed by the base targets role
|
||||||
for idx, sig := range signatureRows {
|
for idx, sig := range signatureRows {
|
||||||
if len(sig.Signers) == 0 {
|
if len(sig.Signers) == 0 {
|
||||||
signatureRows[idx].Signers = append(sig.Signers, releasedRoleName)
|
signatureRows[idx].Signers = []string{releasedRoleName}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue