DockerCLI/cli/command/stack
Sebastiaan van Stijn be14edca2a
cli/command/stack: fix faulty sort for sorting stacks
This code was updated in 7b9580df51, which
removed support for using kubernetes as orchestrator, but in doing so
made this `sort.Slice` (probably) not do what it was expected to do ':)

    index 412cc2e5ee86..861ae1be2fb9 100644
    @@ -75,8 +54,7 @@ func format(dockerCli command.Cli, opts options.List, orchestrator command.Orche
        }
        sort.Slice(stacks, func(i, j int) bool {
            return sortorder.NaturalLess(stacks[i].Name, stacks[j].Name) ||
    -            !sortorder.NaturalLess(stacks[j].Name, stacks[i].Name) &&
    -            sortorder.NaturalLess(stacks[j].Namespace, stacks[i].Namespace)
    +            !sortorder.NaturalLess(stacks[j].Name, stacks[i].Name)
        })
        return formatter.StackWrite(stackCtx, stacks)
     }

The extra condition was added in 84241cc393
to support multiple namespaces. This patch removes it, bringing it back to
the state it was before that commit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 13:19:37 +02:00
..
formatter linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
loader Update go:build comments to go1.21 2024-06-18 12:17:13 +02:00
options Add support for --detach/-d flag in stack rm 2024-03-04 09:56:53 +01:00
swarm linting: fmt.Sprintf can be replaced with string concatenation (perfsprint) 2024-06-10 21:19:32 +02:00
testdata remove obsolete mutli-orchestrator support 2022-02-22 15:28:12 +01:00
client_test.go vendor: github.com/docker/docker c6aaabc9fc82 (master / v27.0.0-dev) 2024-06-05 16:29:55 +02:00
cmd.go cli/command: use shallower interface for completions 2024-06-04 12:04:11 +02:00
common.go Drop support for (archived) Compose-on-Kubernetes 2022-02-22 13:47:34 +01:00
config.go golangci-lint: revive: enable import-shadowing 2023-11-20 19:52:41 +01:00
config_test.go Removed all mentions of "please" from docs and messages 2024-06-11 16:53:40 +02:00
deploy.go Add support for --detach flag in stack deploy 2024-03-04 09:36:36 +01:00
deploy_test.go cli/command/stack: remove deprecated io/ioutil 2022-02-25 15:42:10 +01:00
list.go cli/command/stack: fix faulty sort for sorting stacks 2024-07-01 13:19:37 +02:00
list_test.go cli/command: remove dot-imports and unhandled errors 2023-10-23 15:21:47 +02:00
ps.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
ps_test.go cli/command: remove dot-imports and unhandled errors 2023-10-23 15:21:47 +02:00
remove.go Add support for --detach/-d flag in stack rm 2024-03-04 09:56:53 +01:00
remove_test.go format code with gofumpt 2022-09-30 11:59:11 +02:00
services.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
services_test.go cli/command: remove dot-imports and unhandled errors 2023-10-23 15:21:47 +02:00