Skip to content

Commit e3658a6

Browse files
authored
Merge pull request #4643 from kersten/fix/shadowed-errors-variable
🌱 (chore): avoid variable shadowing by renaming local 'errors' variable
2 parents 41d7579 + 27e2bdb commit e3658a6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/model/resource/gvk.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,17 @@ func (gvk GVK) Validate() error {
5656
if gvk.Version == "" {
5757
return errors.New(versionRequired)
5858
}
59-
errs := validation.IsDNS1123Subdomain(gvk.Version)
60-
if len(errs) > 0 && gvk.Version != versionInternal {
59+
if errs := validation.IsDNS1123Subdomain(gvk.Version); len(errs) > 0 && gvk.Version != versionInternal {
6160
return fmt.Errorf("Version must respect DNS-1123 (was %s)", gvk.Version)
6261
}
6362

6463
// Check if kind has a valid DNS1035 label value
6564
if gvk.Kind == "" {
6665
return errors.New(kindRequired)
6766
}
68-
if errors := validation.IsDNS1035Label(strings.ToLower(gvk.Kind)); len(errors) != 0 {
67+
if errs := validation.IsDNS1035Label(strings.ToLower(gvk.Kind)); len(errs) != 0 {
6968
// NOTE: IsDNS1035Label returns a slice of strings instead of an error, so no wrapping
70-
return fmt.Errorf("invalid Kind: %#v", errors)
69+
return fmt.Errorf("invalid Kind: %#v", errs)
7170
}
7271

7372
// Require kind to start with an uppercase character

0 commit comments

Comments
 (0)