aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-09-26 11:24:34 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-09-28 02:11:59 +0000
commit5a4c7a9ce4162f8f9fb397d6b9b59e7fe59beeea (patch)
tree60e2e47b271a85200eef2b483a9a5593b8a6ef22 /extras/hs-test
parent6f173171b1d5c4b10165a7d8603e4e6b9d07b7b4 (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/hs-test')
-rw-r--r--extras/hs-test/Makefile20
-rw-r--r--extras/hs-test/http_test.go5
-rw-r--r--extras/hs-test/infra/container.go3
-rw-r--r--extras/hs-test/infra/cpu.go3
-rw-r--r--extras/hs-test/infra/hst_suite.go3
-rw-r--r--extras/hs-test/infra/suite_cpu_pinning.go3
-rw-r--r--extras/hs-test/infra/suite_envoy_proxy.go3
-rw-r--r--extras/hs-test/infra/suite_vpp_proxy.go3
-rw-r--r--extras/hs-test/infra/vppinstance.go3
-rw-r--r--extras/hs-test/mem_leak_test.go3
-rw-r--r--extras/hs-test/nginx_test.go5
-rw-r--r--extras/hs-test/proxy_test.go3
12 files changed, 39 insertions, 18 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() {