hs-test: fix code style
This will add a new target (fixstyle) to Makefile that runs gofmt tool.
Type: style
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Icba60633f82aa8bbc75749f080e00f0375b55a18
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index 9026555..c50e681 100755
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -7,4 +7,7 @@
docker:
bash ./script/build.sh
+fixstyle:
+ @gofmt -w .
+
.PHONY: docker
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 5aa5e47..4ad4548 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -47,7 +47,7 @@
}
if _, ok := yamlInput["volumes"]; ok {
- r:= strings.NewReplacer("$HST_DIR", workDir)
+ r := strings.NewReplacer("$HST_DIR", workDir)
for _, volu := range yamlInput["volumes"].([]interface{}) {
volumeMap := volu.(ContainerConfig)
hostDir := r.Replace(volumeMap["host-dir"].(string))
@@ -55,8 +55,8 @@
container.addVolume(hostDir, containerDir)
if isDefaultWorkDir, ok := volumeMap["is-default-work-dir"]; ok &&
- isDefaultWorkDir.(bool) &&
- len(container.workDir) == 0 {
+ isDefaultWorkDir.(bool) &&
+ len(container.workDir) == 0 {
container.workDir = containerDir
}
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 8d81cde..2dfdf8b 100755
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -81,7 +81,7 @@
var clnRes = make(chan string, 1)
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
go StartClientApp(clnEnv, clnCh, clnRes)
- s.log(<- clnRes)
+ s.log(<-clnRes)
// wait for client's result
err = <-clnCh
diff --git a/extras/hs-test/linux_iperf_test.go b/extras/hs-test/linux_iperf_test.go
index 38649e5..833fb2c 100755
--- a/extras/hs-test/linux_iperf_test.go
+++ b/extras/hs-test/linux_iperf_test.go
@@ -15,7 +15,7 @@
s.log("server running")
go StartClientApp(nil, clnCh, clnRes)
s.log("client running")
- s.log(<- clnRes)
+ s.log(<-clnRes)
err = <-clnCh
s.assertNil(err)
s.log("Test completed")
diff --git a/extras/hs-test/suite_ns_test.go b/extras/hs-test/suite_ns_test.go
index d45f6cc..cf7f0ec 100644
--- a/extras/hs-test/suite_ns_test.go
+++ b/extras/hs-test/suite_ns_test.go
@@ -8,4 +8,3 @@
s.teardownSuite = setupSuite(&s.Suite, "ns")
s.loadContainerTopology("ns")
}
-
diff --git a/extras/hs-test/suite_tap_test.go b/extras/hs-test/suite_tap_test.go
index ffcd8b7..26f5224 100644
--- a/extras/hs-test/suite_tap_test.go
+++ b/extras/hs-test/suite_tap_test.go
@@ -12,4 +12,3 @@
time.Sleep(1 * time.Second)
s.teardownSuite = setupSuite(&s.Suite, "tap")
}
-
diff --git a/extras/hs-test/suite_veth_test.go b/extras/hs-test/suite_veth_test.go
index f41e87d..5276072 100644
--- a/extras/hs-test/suite_veth_test.go
+++ b/extras/hs-test/suite_veth_test.go
@@ -13,4 +13,3 @@
s.teardownSuite = setupSuite(&s.Suite, "2peerVeth")
s.loadContainerTopology("2peerVeth")
}
-
diff --git a/extras/hs-test/topo.go b/extras/hs-test/topo.go
index 1d501e8..cf50dad 100755
--- a/extras/hs-test/topo.go
+++ b/extras/hs-test/topo.go
@@ -13,9 +13,9 @@
type ContainerConfig map[string]interface{}
type YamlTopology struct {
- Devices []NetDevConfig `yaml:"devices"`
+ Devices []NetDevConfig `yaml:"devices"`
Containers []ContainerConfig `yaml:"containers"`
- Volumes []string `yaml:"volumes"`
+ Volumes []string `yaml:"volumes"`
}
func AddAddress(device, address, ns string) error {
diff --git a/extras/hs-test/vcl_test.go b/extras/hs-test/vcl_test.go
index 5a5ba06..f4273c8 100755
--- a/extras/hs-test/vcl_test.go
+++ b/extras/hs-test/vcl_test.go
@@ -32,12 +32,12 @@
echoSrvContainer := s.getContainerByName("server-application")
// run server app
- _, err = echoSrvContainer.execAction("RunEchoServer "+proto)
+ _, err = echoSrvContainer.execAction("RunEchoServer " + proto)
s.assertNil(err)
echoClnContainer := s.getContainerByName("client-application")
- o, err := echoClnContainer.execAction("RunEchoClient "+proto)
+ o, err := echoClnContainer.execAction("RunEchoClient " + proto)
s.assertNil(err)
s.log(o)
@@ -60,13 +60,13 @@
s.assertNil(err)
echoSrvContainer := s.getContainerByName("server-application")
- _, err = echoSrvContainer.execAction("RunVclEchoServer "+proto)
+ _, err = echoSrvContainer.execAction("RunVclEchoServer " + proto)
s.assertNil(err)
s.log("This whole test case can take around 3 minutes to run. Please be patient.")
s.log("... Running first echo client test, before disconnect.")
echoClnContainer := s.getContainerByName("client-application")
- _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
+ _, err = echoClnContainer.execAction("RunVclEchoClient " + proto)
s.assertNil(err)
s.log("... First test ended. Stopping VPP server now.")
@@ -85,7 +85,7 @@
time.Sleep(30 * time.Second) // Wait a moment for the re-attachment to happen
s.log("... Running second echo client test, after disconnect and re-attachment.")
- _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
+ _, err = echoClnContainer.execAction("RunVclEchoClient " + proto)
s.assertNil(err)
s.log("Done.")
}
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go
index 6194ce8..15524b8 100644
--- a/extras/hs-test/vppinstance.go
+++ b/extras/hs-test/vppinstance.go
@@ -1,8 +1,8 @@
package main
import (
- "fmt"
"encoding/json"
+ "fmt"
"github.com/edwarnicke/exechelper"
)
@@ -45,13 +45,13 @@
)
type VppInstance struct {
- container *Container
- config VppConfig
+ container *Container
+ config VppConfig
actionFuncName string
}
type VppConfig struct {
- Variant string
+ Variant string
CliSocketFilePath string
}