Skip to content

Commit 8278f65

Browse files
committed
use strings.TrimPrefix instead of TrimLeft
1 parent 77b0ae2 commit 8278f65

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

explore/options.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ func (o *Options) Complete(f cmdutil.Factory, args []string) error {
159159
var re string
160160
if strings.HasPrefix(o.inputFieldPath, gotGVR.Resource) {
161161
// E.g., "nodes.*spec" -> ".*spec"
162-
re = strings.TrimLeft(o.inputFieldPath, gotGVR.Resource)
162+
re = strings.TrimPrefix(o.inputFieldPath, gotGVR.Resource)
163163
} else if strings.HasPrefix(o.inputFieldPath, singularResource(gotGVR.Resource)) {
164164
// E.g., "node.*spec" -> ".*spec"
165-
re = strings.TrimLeft(o.inputFieldPath, singularResource(gotGVR.Resource))
165+
re = strings.TrimPrefix(o.inputFieldPath, singularResource(gotGVR.Resource))
166166
} else {
167167
// E.g., "no.*spec" -> ".*spec"
168-
left := o.inputFieldPath[:idx]
169-
re = strings.TrimLeft(o.inputFieldPath, left)
168+
prefix := o.inputFieldPath[:idx]
169+
re = strings.TrimPrefix(o.inputFieldPath, prefix)
170170
}
171171
o.inputFieldPathRegex, err = regexp.Compile(re)
172172
if err != nil {

0 commit comments

Comments
 (0)