diff options
author | Adrian Villin <avillin@cisco.com> | 2024-09-26 11:24:34 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-09-28 02:11:59 +0000 |
commit | 5a4c7a9ce4162f8f9fb397d6b9b59e7fe59beeea (patch) | |
tree | 60e2e47b271a85200eef2b483a9a5593b8a6ef22 /extras | |
parent | 6f173171b1d5c4b10165a7d8603e4e6b9d07b7b4 (diff) |
hs-test: replaced gofmt with goimports
- goimports properly formats imports
Type: test
Change-Id: I78c162dd552fd3ee3d59955d7ea215af30601425
Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/hs-test/Makefile | 20 | ||||
-rw-r--r-- | extras/hs-test/http_test.go | 5 | ||||
-rw-r--r-- | extras/hs-test/infra/container.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/cpu.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/hst_suite.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_cpu_pinning.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_envoy_proxy.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_vpp_proxy.go | 3 | ||||
-rw-r--r-- | extras/hs-test/infra/vppinstance.go | 3 | ||||
-rw-r--r-- | extras/hs-test/mem_leak_test.go | 3 | ||||
-rw-r--r-- | extras/hs-test/nginx_test.go | 5 | ||||
-rw-r--r-- | extras/hs-test/proxy_test.go | 3 | ||||
-rwxr-xr-x | extras/vpp_if_stats/apimock.go | 5 | ||||
-rwxr-xr-x | extras/vpp_if_stats/json_structs.go | 1 | ||||
-rwxr-xr-x | extras/vpp_if_stats/statsmock.go | 3 | ||||
-rw-r--r-- | extras/vpp_if_stats/vpp_if_stats.go | 3 | ||||
-rw-r--r-- | extras/vpp_if_stats/vpp_if_stats_test.go | 7 |
17 files changed, 51 insertions, 25 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile index 2a501580e53..b72aca1d7dd 100644 --- a/extras/hs-test/Makefile +++ b/extras/hs-test/Makefile @@ -184,10 +184,19 @@ install-deps: @apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin @touch .deps.ok +.goimports.ok: + @rm -f .goimports.ok + go install golang.org/x/tools/cmd/goimports@v0.25.0 + @touch .goimports.ok + .PHONY: checkstyle-go -checkstyle-go: - @output=$$(gofmt -d $${WS_ROOT}); \ - if [ -z "$$output" ]; then \ +checkstyle-go: .goimports.ok + $(eval GOPATH := $(shell go env GOPATH)) + @output=$$($(GOPATH)/bin/goimports -d $${WS_ROOT}); \ + status=$$?; \ + if [ $$status -ne 0 ]; then \ + exit $$status; \ + elif [ -z "$$output" ]; then \ echo "*******************************************************************"; \ echo "Checkstyle OK."; \ echo "*******************************************************************"; \ @@ -200,9 +209,10 @@ checkstyle-go: fi .PHONY: fixstyle-go -fixstyle-go: +fixstyle-go: .goimports.ok + $(eval GOPATH := $(shell go env GOPATH)) @echo "Modified files:" - @gofmt -w -l $(WS_ROOT) + @$(GOPATH)/bin/goimports -w -l $(WS_ROOT) @go mod tidy @echo "*******************************************************************" @echo "Fixstyle done." diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index bfd2d34483c..d1d28fb893c 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -3,8 +3,6 @@ package main import ( "bytes" "fmt" - "github.com/onsi/gomega/ghttp" - "github.com/onsi/gomega/gmeasure" "io" "math/rand" "net" @@ -15,6 +13,9 @@ import ( "sync" "time" + "github.com/onsi/gomega/ghttp" + "github.com/onsi/gomega/gmeasure" + . "fd.io/hs-test/infra" . "github.com/onsi/ginkgo/v2" ) diff --git a/extras/hs-test/infra/container.go b/extras/hs-test/infra/container.go index 974d1547c03..8ec9b8cd02c 100644 --- a/extras/hs-test/infra/container.go +++ b/extras/hs-test/infra/container.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "fmt" - "github.com/docker/go-units" "os" "os/exec" "regexp" @@ -14,6 +13,8 @@ import ( "text/template" "time" + "github.com/docker/go-units" + "github.com/cilium/cilium/pkg/sysctl" containerTypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" diff --git a/extras/hs-test/infra/cpu.go b/extras/hs-test/infra/cpu.go index a1682819a2f..615f8a3f87d 100644 --- a/extras/hs-test/infra/cpu.go +++ b/extras/hs-test/infra/cpu.go @@ -4,11 +4,12 @@ import ( "bufio" "errors" "fmt" - . "github.com/onsi/ginkgo/v2" "os" "os/exec" "strconv" "strings" + + . "github.com/onsi/ginkgo/v2" ) var CgroupPath = "/sys/fs/cgroup/" diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index ed8da3fe244..234a8409ea0 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -4,7 +4,6 @@ import ( "bufio" "flag" "fmt" - "github.com/edwarnicke/exechelper" "io" "log" "net/http" @@ -17,6 +16,8 @@ import ( "strings" "time" + "github.com/edwarnicke/exechelper" + containerTypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" "github.com/onsi/gomega/gmeasure" diff --git a/extras/hs-test/infra/suite_cpu_pinning.go b/extras/hs-test/infra/suite_cpu_pinning.go index e829efa950b..355fdf96604 100644 --- a/extras/hs-test/infra/suite_cpu_pinning.go +++ b/extras/hs-test/infra/suite_cpu_pinning.go @@ -2,10 +2,11 @@ package hst import ( "fmt" - . "github.com/onsi/ginkgo/v2" "reflect" "runtime" "strings" + + . "github.com/onsi/ginkgo/v2" ) var cpuPinningTests = map[string][]func(s *CpuPinningSuite){} diff --git a/extras/hs-test/infra/suite_envoy_proxy.go b/extras/hs-test/infra/suite_envoy_proxy.go index 80715214cac..e34a7d74225 100644 --- a/extras/hs-test/infra/suite_envoy_proxy.go +++ b/extras/hs-test/infra/suite_envoy_proxy.go @@ -7,10 +7,11 @@ package hst import ( "fmt" - . "github.com/onsi/ginkgo/v2" "reflect" "runtime" "strings" + + . "github.com/onsi/ginkgo/v2" ) const ( diff --git a/extras/hs-test/infra/suite_vpp_proxy.go b/extras/hs-test/infra/suite_vpp_proxy.go index 21e81e0581e..868684bcede 100644 --- a/extras/hs-test/infra/suite_vpp_proxy.go +++ b/extras/hs-test/infra/suite_vpp_proxy.go @@ -7,10 +7,11 @@ package hst import ( "fmt" - . "github.com/onsi/ginkgo/v2" "reflect" "runtime" "strings" + + . "github.com/onsi/ginkgo/v2" ) // These correspond to names used in yaml config diff --git a/extras/hs-test/infra/vppinstance.go b/extras/hs-test/infra/vppinstance.go index b3ae995870f..a1f2ce46ed3 100644 --- a/extras/hs-test/infra/vppinstance.go +++ b/extras/hs-test/infra/vppinstance.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "go.fd.io/govpp/binapi/ethernet_types" "io" "net" "os" @@ -15,6 +14,8 @@ import ( "syscall" "time" + "go.fd.io/govpp/binapi/ethernet_types" + "github.com/edwarnicke/exechelper" . "github.com/onsi/ginkgo/v2" "github.com/sirupsen/logrus" diff --git a/extras/hs-test/mem_leak_test.go b/extras/hs-test/mem_leak_test.go index 76966ae968a..0d8831d2bbc 100644 --- a/extras/hs-test/mem_leak_test.go +++ b/extras/hs-test/mem_leak_test.go @@ -1,8 +1,9 @@ package main import ( - . "fd.io/hs-test/infra" "fmt" + + . "fd.io/hs-test/infra" ) func init() { diff --git a/extras/hs-test/nginx_test.go b/extras/hs-test/nginx_test.go index fa6afda58fc..8bf681d18c6 100644 --- a/extras/hs-test/nginx_test.go +++ b/extras/hs-test/nginx_test.go @@ -1,11 +1,12 @@ package main import ( - . "fd.io/hs-test/infra" "fmt" - . "github.com/onsi/ginkgo/v2" "os" "strings" + + . "fd.io/hs-test/infra" + . "github.com/onsi/ginkgo/v2" ) func init() { diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index 7ec97c76c02..758064424a8 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -1,8 +1,9 @@ package main import ( - . "fd.io/hs-test/infra" "fmt" + + . "fd.io/hs-test/infra" ) func init() { diff --git a/extras/vpp_if_stats/apimock.go b/extras/vpp_if_stats/apimock.go index 77363344090..25e76ed1d31 100755 --- a/extras/vpp_if_stats/apimock.go +++ b/extras/vpp_if_stats/apimock.go @@ -5,10 +5,11 @@ package main import ( - api "git.fd.io/govpp.git/api" - gomock "github.com/golang/mock/gomock" reflect "reflect" time "time" + + api "git.fd.io/govpp.git/api" + gomock "github.com/golang/mock/gomock" ) // MockChannel is a mock of Channel interface diff --git a/extras/vpp_if_stats/json_structs.go b/extras/vpp_if_stats/json_structs.go index a42b6d815b2..8e73337418e 100755 --- a/extras/vpp_if_stats/json_structs.go +++ b/extras/vpp_if_stats/json_structs.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "git.fd.io/govpp.git/examples/bin_api/vpe" ) diff --git a/extras/vpp_if_stats/statsmock.go b/extras/vpp_if_stats/statsmock.go index 72528f53d9a..172176fa744 100755 --- a/extras/vpp_if_stats/statsmock.go +++ b/extras/vpp_if_stats/statsmock.go @@ -5,9 +5,10 @@ package main import ( + reflect "reflect" + adapter "git.fd.io/govpp.git/adapter" gomock "github.com/golang/mock/gomock" - reflect "reflect" ) // MockStatsAPI is a mock of StatsAPI interface diff --git a/extras/vpp_if_stats/vpp_if_stats.go b/extras/vpp_if_stats/vpp_if_stats.go index 90c1700430c..751bbe5d5a9 100644 --- a/extras/vpp_if_stats/vpp_if_stats.go +++ b/extras/vpp_if_stats/vpp_if_stats.go @@ -3,6 +3,8 @@ package main import ( "flag" "fmt" + "log" + "git.fd.io/govpp.git" "git.fd.io/govpp.git/adapter" "git.fd.io/govpp.git/adapter/vppapiclient" @@ -10,7 +12,6 @@ import ( "git.fd.io/govpp.git/core" "git.fd.io/govpp.git/examples/bin_api/interfaces" "git.fd.io/govpp.git/examples/bin_api/vpe" - "log" ) ////////////////////////////////////// diff --git a/extras/vpp_if_stats/vpp_if_stats_test.go b/extras/vpp_if_stats/vpp_if_stats_test.go index 3c22ce85d75..53c990c4158 100644 --- a/extras/vpp_if_stats/vpp_if_stats_test.go +++ b/extras/vpp_if_stats/vpp_if_stats_test.go @@ -1,15 +1,16 @@ package main import ( + "math/rand" + "testing" + "time" + "git.fd.io/govpp.git/adapter" "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/examples/bin_api/interfaces" "git.fd.io/govpp.git/examples/bin_api/vpe" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - "math/rand" - "testing" - "time" ) var ( |