Skip to content

Commit 282d6bb

Browse files
authored
Fix linter issues (#7431)
1 parent 9a0a3f7 commit 282d6bb

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

internal/k8s/appprotect/app_protect_configuration.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,23 +401,23 @@ func (ci *ConfigurationImpl) GetAppResource(kind, key string) (*unstructured.Uns
401401
if obj.IsValid {
402402
return obj.Obj, nil
403403
}
404-
return nil, fmt.Errorf(obj.ErrorMsg)
404+
return nil, errors.New(obj.ErrorMsg)
405405
}
406406
return nil, fmt.Errorf("app protect Policy %s not found", key)
407407
case LogConfGVK.Kind:
408408
if obj, ok := ci.LogConfs[key]; ok {
409409
if obj.IsValid {
410410
return obj.Obj, nil
411411
}
412-
return nil, fmt.Errorf(obj.ErrorMsg)
412+
return nil, errors.New(obj.ErrorMsg)
413413
}
414414
return nil, fmt.Errorf("app protect LogConf %s not found", key)
415415
case UserSigGVK.Kind:
416416
if obj, ok := ci.UserSigs[key]; ok {
417417
if obj.IsValid {
418418
return obj.Obj, nil
419419
}
420-
return nil, fmt.Errorf(obj.ErrorMsg)
420+
return nil, errors.New(obj.ErrorMsg)
421421
}
422422
return nil, fmt.Errorf("app protect UserSig %s not found", key)
423423
}

internal/k8s/appprotectdos/app_protect_dos_configuration.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package appprotectdos
22

33
import (
4+
"errors"
45
"fmt"
56
"strings"
67

@@ -198,7 +199,7 @@ func (ci *Configuration) getPolicy(key string) (*unstructured.Unstructured, erro
198199
return nil, fmt.Errorf("DosPolicy %s not found", key)
199200
}
200201
if !obj.IsValid {
201-
return nil, fmt.Errorf(obj.ErrorMsg)
202+
return nil, errors.New(obj.ErrorMsg)
202203
}
203204
return obj.Obj, nil
204205
}
@@ -209,7 +210,7 @@ func (ci *Configuration) getLogConf(key string) (*unstructured.Unstructured, err
209210
return nil, fmt.Errorf("DosLogConf %s not found", key)
210211
}
211212
if !obj.IsValid {
212-
return nil, fmt.Errorf(obj.ErrorMsg)
213+
return nil, errors.New(obj.ErrorMsg)
213214
}
214215
return obj.Obj, nil
215216
}
@@ -219,7 +220,7 @@ func (ci *Configuration) getDosProtected(key string) (*v1beta1.DosProtectedResou
219220
if obj.IsValid {
220221
return obj.Obj, nil
221222
}
222-
return nil, fmt.Errorf(obj.ErrorMsg)
223+
return nil, errors.New(obj.ErrorMsg)
223224
}
224225
return nil, fmt.Errorf("DosProtectedResource %s not found", key)
225226
}
@@ -236,7 +237,7 @@ func (ci *Configuration) GetValidDosEx(parentNamespace string, nsName string) (*
236237
return nil, fmt.Errorf("DosProtectedResource %s not found", key)
237238
}
238239
if !protectedEx.IsValid {
239-
return nil, fmt.Errorf(protectedEx.ErrorMsg)
240+
return nil, errors.New(protectedEx.ErrorMsg)
240241
}
241242
dosEx.DosProtected = protectedEx.Obj
242243
if protectedEx.Obj.Spec.ApDosPolicy != "" {

0 commit comments

Comments
 (0)