1
0
mirror of https://github.com/docker/cli.git synced 2026-11-01 23:35:23 +03:00

modernize: stringscut

go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -stringscut -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-02-11 13:16:13 +01:00
parent 4c7d40cf77
commit 2875e48024

View File

@@ -155,11 +155,11 @@ func (e statusError) Error() string {
// Note: The root command's name is excluded. If cmd is the root cmd, return ""
func getCommandName(cmd *cobra.Command) string {
fullCmdName := getFullCommandName(cmd)
i := strings.Index(fullCmdName, " ")
if i == -1 {
_, after, ok := strings.Cut(fullCmdName, " ")
if !ok {
return ""
}
return fullCmdName[i+1:]
return after
}
// getFullCommandName gets the full cobra command name in the format