Skip to content

Commit 34f7885

Browse files
HadrienPattetklauser
authored andcommitted
modernize: stringscutprefix
replace some uses of HasPrefix followed by TrimPrefix with CutPrefix, added to the strings package in go1.20. Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
1 parent a4e58b2 commit 34f7885

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cilium-cli/cli/connectivity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func RunE(hooks api.Hooks) func(cmd *cobra.Command, args []string) error {
5959
params.ImpersonateGroups = impersonateGroups
6060

6161
for _, test := range tests {
62-
if strings.HasPrefix(test, "!") {
63-
rgx, err := regexp.Compile(strings.TrimPrefix(test, "!"))
62+
if after, ok := strings.CutPrefix(test, "!"); ok {
63+
rgx, err := regexp.Compile(after)
6464
if err != nil {
6565
return fmt.Errorf("test filter: %w", err)
6666
}

0 commit comments

Comments
 (0)