hs-test: replaced gofmt with goimports

- goimports properly formats imports

Type: test

Change-Id: I78c162dd552fd3ee3d59955d7ea215af30601425
Signed-off-by: Adrian Villin <avillin@cisco.com>
This commit is contained in:
Adrian Villin 2024-09-26 11:24:34 +02:00 committed by Florin Coras
parent 6f173171b1
commit 5a4c7a9ce4
18 changed files with 52 additions and 25 deletions

1
.gitignore vendored
View File

@ -132,6 +132,7 @@ compile_commands.json
/extras/hs-test/.build.ok
/extras/hs-test/.build.cov.ok
/extras/hs-test/.last_hst_ppid
/extras/hs-test/.goimports.ok
/extras/hs-test/summary/
# ./configure

View File

@ -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."

View File

@ -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"
)

View File

@ -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"

View File

@ -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/"

View File

@ -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"

View File

@ -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){}

View File

@ -7,10 +7,11 @@ package hst
import (
"fmt"
. "github.com/onsi/ginkgo/v2"
"reflect"
"runtime"
"strings"
. "github.com/onsi/ginkgo/v2"
)
const (

View File

@ -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

View File

@ -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"

View File

@ -1,8 +1,9 @@
package main
import (
. "fd.io/hs-test/infra"
"fmt"
. "fd.io/hs-test/infra"
)
func init() {

View File

@ -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() {

View File

@ -1,8 +1,9 @@
package main
import (
. "fd.io/hs-test/infra"
"fmt"
. "fd.io/hs-test/infra"
)
func init() {

View File

@ -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

View File

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"git.fd.io/govpp.git/examples/bin_api/vpe"
)

View File

@ -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

View File

@ -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"
)
//////////////////////////////////////

View File

@ -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 (