Skip to content

Commit 2875e48

Browse files
committed
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>
1 parent 4c7d40c commit 2875e48

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cli/command/telemetry_utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ func (e statusError) Error() string {
155155
// Note: The root command's name is excluded. If cmd is the root cmd, return ""
156156
func getCommandName(cmd *cobra.Command) string {
157157
fullCmdName := getFullCommandName(cmd)
158-
i := strings.Index(fullCmdName, " ")
159-
if i == -1 {
158+
_, after, ok := strings.Cut(fullCmdName, " ")
159+
if !ok {
160160
return ""
161161
}
162-
return fullCmdName[i+1:]
162+
return after
163163
}
164164

165165
// getFullCommandName gets the full cobra command name in the format

0 commit comments

Comments
 (0)