diff options
-rw-r--r-- | config/bgp_configs_test.go | 5 | ||||
-rw-r--r-- | config/default.go | 10 | ||||
-rw-r--r-- | config/default_linux.go | 5 | ||||
-rw-r--r-- | config/serve.go | 3 | ||||
-rw-r--r-- | config/util_test.go | 3 |
5 files changed, 12 insertions, 14 deletions
diff --git a/config/bgp_configs_test.go b/config/bgp_configs_test.go index 152ace2c..7a98e1ae 100644 --- a/config/bgp_configs_test.go +++ b/config/bgp_configs_test.go @@ -90,10 +90,7 @@ func extractTomlFromMarkdown(fileMd string, fileToml string) error { } fTomlWriter.Flush() - if err := scanner.Err(); err != nil { - return err - } - return nil + return scanner.Err() } func TestConfigExample(t *testing.T) { diff --git a/config/default.go b/config/default.go index 3529c4e4..1576bb33 100644 --- a/config/default.go +++ b/config/default.go @@ -187,11 +187,11 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, g *Glo if len(afs) > i { vv.Set("afi-safi", afs[i]) } - if rf, err := bgp.GetRouteFamily(string(n.AfiSafis[i].Config.AfiSafiName)); err != nil { + rf, err := bgp.GetRouteFamily(string(n.AfiSafis[i].Config.AfiSafiName)) + if err != nil { return err - } else { - n.AfiSafis[i].State.Family = rf } + n.AfiSafis[i].State.Family = rf n.AfiSafis[i].State.AfiSafiName = n.AfiSafis[i].Config.AfiSafiName if !vv.IsSet("afi-safi.config.enabled") { n.AfiSafis[i].Config.Enabled = true @@ -263,7 +263,7 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, g *Glo func SetDefaultGlobalConfigValues(g *Global) error { if len(g.AfiSafis) == 0 { g.AfiSafis = []AfiSafi{} - for k, _ := range AfiSafiTypeToIntMap { + for k := range AfiSafiTypeToIntMap { g.AfiSafis = append(g.AfiSafis, defaultAfiSafi(k, true)) } } @@ -324,7 +324,7 @@ func setDefaultPolicyConfigValuesWithViper(v *viper.Viper, p *PolicyDefinition) if err != nil { return err } - for i, _ := range p.Statements { + for i := range p.Statements { vv := viper.New() if len(stmts) > i { vv.Set("statement", stmts[i]) diff --git a/config/default_linux.go b/config/default_linux.go index 6bee2317..f83b76fe 100644 --- a/config/default_linux.go +++ b/config/default_linux.go @@ -18,8 +18,9 @@ package config import ( "fmt" - "github.com/vishvananda/netlink" "net" + + "github.com/vishvananda/netlink" ) func GetIPv6LinkLocalNeighborAddress(ifname string) (string, error) { @@ -40,7 +41,7 @@ func GetIPv6LinkLocalNeighborAddress(ifname string) (string, error) { } if neigh.State&netlink.NUD_FAILED == 0 && neigh.IP.IsLinkLocalUnicast() && !local { addr = neigh.IP - cnt += 1 + cnt++ } } diff --git a/config/serve.go b/config/serve.go index 7705b1f8..8b2f1cfc 100644 --- a/config/serve.go +++ b/config/serve.go @@ -147,9 +147,8 @@ func CheckPolicyDifference(currentPolicy *RoutingPolicy, newPolicy *RoutingPolic "Topic": "Config", }).Debugf("New policy:%s", newPolicy) - var result bool = false + var result bool if currentPolicy == nil && newPolicy == nil { - result = false } else { if currentPolicy != nil && newPolicy != nil { diff --git a/config/util_test.go b/config/util_test.go index 872fac67..a34b02f4 100644 --- a/config/util_test.go +++ b/config/util_test.go @@ -16,8 +16,9 @@ package config import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestDetectConfigFileType(t *testing.T) { |