chore(lint): upgrade linter to v1.56.2

This commit is contained in:
Quentin McGaw
2024-03-21 09:48:02 +00:00
parent fb00fb16c2
commit c0621bf381
20 changed files with 74 additions and 35 deletions

View File

@@ -180,8 +180,7 @@ func (c *Config) allowOutboundSubnets(ctx context.Context) (err error) {
}
if !firewallUpdated {
c.logger.Info(fmt.Sprintf("ignoring subnet %s which has "+
"no default route matching its family", subnet))
c.logIgnoredSubnetFamily(subnet)
}
}
return nil

View File

@@ -1,7 +1,17 @@
package firewall
import (
"fmt"
"net/netip"
)
type Logger interface {
Debug(s string)
Info(s string)
Error(s string)
}
func (c *Config) logIgnoredSubnetFamily(subnet netip.Prefix) {
c.logger.Info(fmt.Sprintf("ignoring subnet %s which has "+
"no default route matching its family", subnet))
}

View File

@@ -57,8 +57,7 @@ func (c *Config) removeOutboundSubnets(ctx context.Context, subnets []netip.Pref
}
if !firewallUpdated {
c.logger.Info(fmt.Sprintf("ignoring subnet %s which has "+
"no default route matching its family", subNet))
c.logIgnoredSubnetFamily(subNet)
continue
}
c.outboundSubnets = subnet.RemoveSubnetFromSubnets(c.outboundSubnets, subNet)
@@ -86,8 +85,7 @@ func (c *Config) addOutboundSubnets(ctx context.Context, subnets []netip.Prefix)
}
if !firewallUpdated {
c.logger.Info(fmt.Sprintf("ignoring subnet %s which has "+
"no default route matching its family", subnet))
c.logIgnoredSubnetFamily(subnet)
continue
}
c.outboundSubnets = append(c.outboundSubnets, subnet)

View File

@@ -216,7 +216,7 @@ func Test_testIptablesPath(t *testing.T) {
runner.EXPECT().Run(newAppendTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newDeleteTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newListInputRulesMatcher(path)).
Return("\nChain INPUT (policy "+inputPolicy+")\nxx\n", nil)
Return("\nChain INPUT (policy "+inputPolicy+")\nAA\n", nil)
runner.EXPECT().Run(newSetPolicyMatcher(path, inputPolicy)).
Return("Permission denied (you must be root)", errDummy)
return runner
@@ -229,7 +229,7 @@ func Test_testIptablesPath(t *testing.T) {
runner.EXPECT().Run(newAppendTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newDeleteTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newListInputRulesMatcher(path)).
Return("\nChain INPUT (policy "+inputPolicy+")\nxx\n", nil)
Return("\nChain INPUT (policy "+inputPolicy+")\nBB\n", nil)
runner.EXPECT().Run(newSetPolicyMatcher(path, inputPolicy)).
Return("some output", errDummy)
return runner
@@ -242,7 +242,7 @@ func Test_testIptablesPath(t *testing.T) {
runner.EXPECT().Run(newAppendTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newDeleteTestRuleMatcher(path)).Return("", nil)
runner.EXPECT().Run(newListInputRulesMatcher(path)).
Return("\nChain INPUT (policy "+inputPolicy+")\nxx\n", nil)
Return("\nChain INPUT (policy "+inputPolicy+")\nCC\n", nil)
runner.EXPECT().Run(newSetPolicyMatcher(path, inputPolicy)).
Return("some output", nil)
return runner