enable gosimple linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
709e775b13
commit
5a7619c019
@ -3,13 +3,13 @@ linters:
|
||||
- contextcheck
|
||||
- gci
|
||||
- gofumpt
|
||||
- gosimple
|
||||
- ineffassign
|
||||
- misspell
|
||||
- nonamedreturns
|
||||
- staticcheck
|
||||
disable:
|
||||
- errcheck
|
||||
- gosimple
|
||||
|
||||
linters-settings:
|
||||
gci:
|
||||
|
@ -305,7 +305,7 @@ func (l *DHCPLease) maintain() {
|
||||
|
||||
switch state {
|
||||
case leaseStateBound:
|
||||
sleepDur = l.renewalTime.Sub(time.Now())
|
||||
sleepDur = time.Until(l.renewalTime)
|
||||
if sleepDur <= 0 {
|
||||
log.Printf("%v: renewing lease", l.clientID)
|
||||
state = leaseStateRenewing
|
||||
|
@ -47,7 +47,7 @@ func cmdCheck(args *skel.CmdArgs) error {
|
||||
defer store.Close()
|
||||
|
||||
containerIpFound := store.FindByID(args.ContainerID, args.IfName)
|
||||
if containerIpFound == false {
|
||||
if !containerIpFound {
|
||||
return fmt.Errorf("host-local: Failed to find address added by container %v", args.ContainerID)
|
||||
}
|
||||
|
||||
|
@ -1258,7 +1258,6 @@ func (tester *testerV03x) cmdAddTest(tc testCase, dataDir string) (types.Result,
|
||||
}
|
||||
|
||||
func (tester *testerV03x) cmdCheckTest(tc testCase, conf *Net, dataDir string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (tester *testerV03x) cmdDelTest(tc testCase, dataDir string) {
|
||||
@ -1489,7 +1488,6 @@ func (tester *testerV01xOr02x) cmdAddTest(tc testCase, dataDir string) (types.Re
|
||||
}
|
||||
|
||||
func (tester *testerV01xOr02x) cmdCheckTest(tc testCase, conf *Net, dataDir string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (tester *testerV01xOr02x) cmdDelTest(tc testCase, dataDir string) {
|
||||
|
@ -167,7 +167,7 @@ func isolationStage2BridgeRule(bridgeName string) []string {
|
||||
}
|
||||
|
||||
func withDefaultComment(rule []string) []string {
|
||||
defaultComment := fmt.Sprintf("CNI firewall plugin rules (ingressPolicy: same-bridge)")
|
||||
defaultComment := "CNI firewall plugin rules (ingressPolicy: same-bridge)"
|
||||
return withComment(rule, defaultComment)
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
updateResultsMacAddr(tuningConf, args.IfName, tuningConf.Mac)
|
||||
}
|
||||
|
||||
if tuningConf.Promisc != false {
|
||||
if tuningConf.Promisc {
|
||||
if err = changePromisc(args.IfName, true); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -514,7 +514,7 @@ func validateSysctlConf(tuningConf *TuningConf) error {
|
||||
return err
|
||||
}
|
||||
if !match {
|
||||
return errors.New(fmt.Sprintf("Sysctl %s is not allowed. Only the following sysctls are allowed: %+v", sysctl, allowlist))
|
||||
return fmt.Errorf("Sysctl %s is not allowed. Only the following sysctls are allowed: %+v", sysctl, allowlist)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -579,7 +579,7 @@ func validateSysctlConflictingKeys(data []byte) error {
|
||||
|
||||
func validateArgs(args *skel.CmdArgs) error {
|
||||
if strings.Contains(args.IfName, string(os.PathSeparator)) {
|
||||
return errors.New(fmt.Sprintf("Interface name (%s) contains an invalid character %s", args.IfName, string(os.PathSeparator)))
|
||||
return fmt.Errorf("Interface name (%s) contains an invalid character %s", args.IfName, string(os.PathSeparator))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user