diff options
author | Jeff Bean <bean@uber.com> | 2018-06-22 19:12:33 -0700 |
---|---|---|
committer | Jeff Bean <bean@uber.com> | 2018-06-22 19:12:33 -0700 |
commit | 154650594c5b40b2905eb73b90f52de72f6ced16 (patch) | |
tree | 2ba6ffe099ff216a92df7fb3806eb9aeaa988208 /tools | |
parent | 954562d65a90af4e8d2e9bf29e4c2bccc4420b38 (diff) |
Fixing all megacheck errors.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/route-server/quagga-rsconfig.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/route-server/quagga-rsconfig.go b/tools/route-server/quagga-rsconfig.go index 80b9a9d0..517125f3 100644 --- a/tools/route-server/quagga-rsconfig.go +++ b/tools/route-server/quagga-rsconfig.go @@ -45,8 +45,6 @@ func (qt *QuaggaConfig) Config() *bytes.Buffer { } func create_config_files(nr int, outputDir string) { - quaggaConfigList := make([]*QuaggaConfig, 0) - gobgpConf := config.Bgp{} gobgpConf.Global.Config.As = 65000 gobgpConf.Global.Config.RouterId = "192.168.255.1" @@ -60,21 +58,24 @@ func create_config_files(nr int, outputDir string) { gobgpConf.Neighbors = append(gobgpConf.Neighbors, c) q := NewQuaggaConfig(i, &gobgpConf.Global, &c, net.ParseIP("10.0.255.1")) - quaggaConfigList = append(quaggaConfigList, q) - os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, i), 0755) - err := ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.Config().Bytes(), 0644) - if err != nil { + + if err := os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, i), 0755); err != nil { + log.Fatalf("failed to make directory: %v", err) + } + + if err := ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.Config().Bytes(), 0644); err != nil { log.Fatal(err) } } var buffer bytes.Buffer encoder := toml.NewEncoder(&buffer) - encoder.Encode(gobgpConf) + if err := encoder.Encode(gobgpConf); err != nil { + log.Fatalf("failed to encode config: %v", err) + } - err := ioutil.WriteFile(fmt.Sprintf("%s/gobgpd.conf", outputDir), buffer.Bytes(), 0644) - if err != nil { - log.Fatal(err) + if err := ioutil.WriteFile(fmt.Sprintf("%s/gobgpd.conf", outputDir), buffer.Bytes(), 0644); err != nil { + log.Fatalf("failed to write config file: %v", err) } } |