Sort imports with goimports

This commit is contained in:
eikendev 2025-02-22 22:58:13 +01:00
parent b0699da1e9
commit 83a9034be7
No known key found for this signature in database
12 changed files with 29 additions and 15 deletions

View file

@ -3,6 +3,7 @@ OUT_DIR := ./out
TESTS_DIR := ./tests
GO_FILES := $(shell find . -type f \( -iname '*.go' \))
GO_MODULE := github.com/pushbits/server
PB_BUILD_VERSION ?= $(shell git describe --tags)
ifeq ($(PB_BUILD_VERSION),)
@ -21,17 +22,18 @@ clean:
.PHONY: test
test:
stdout=$$(gofumpt -l . 2>&1); if [ "$$stdout" ]; then exit 1; fi
if [ -n "$$(gofumpt -l $(GO_FILES))" ]; then echo "Code is not properly formatted"; exit 1; fi
if [ -n "$$(goimports -l -local $(GO_MODULE) $(GO_FILES))" ]; then echo "Imports are not properly formatted"; exit 1; fi
go vet ./...
misspell -error $(GO_FILES)
gocyclo -over 10 $(GO_FILES)
staticcheck ./...
errcheck -exclude errcheck_excludes.txt ./...
errcheck -ignoregenerated -exclude errcheck_excludes.txt ./...
gocritic check -disable='#experimental,#opinionated' -@ifElseChain.minThreshold 3 ./...
revive -set_exit_status -exclude ./docs ./...
nilaway ./...
go test -v -cover ./...
gosec -exclude-dir=tests ./...
gosec -exclude-generated -exclude-dir=tests ./...
govulncheck ./...
@printf '\n%s\n' "> Test successful"
@ -45,6 +47,7 @@ setup:
go install github.com/securego/gosec/v2/cmd/gosec@latest
go install github.com/swaggo/swag/cmd/swag@latest
go install go.uber.org/nilaway/cmd/nilaway@latest
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install mvdan.cc/gofumpt@latest

View file

@ -6,6 +6,7 @@ import (
"net/url"
"github.com/gin-gonic/gin"
"github.com/pushbits/server/internal/api"
"github.com/pushbits/server/internal/authentication"
"github.com/pushbits/server/internal/log"

View file

@ -6,6 +6,7 @@ import (
"testing"
"github.com/gin-gonic/gin"
"github.com/pushbits/server/internal/authentication/credentials"
"github.com/pushbits/server/internal/configuration"
"github.com/pushbits/server/internal/database"

View file

@ -6,10 +6,11 @@ import (
"io"
"testing"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
)
// Collect all created applications to check & delete them later

View file

@ -3,12 +3,13 @@ package api
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pushbits/server/internal/log"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
"github.com/pushbits/server/tests/mockups"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestApi_getID(t *testing.T) {

View file

@ -3,8 +3,9 @@ package api
import (
"testing"
"github.com/pushbits/server/tests"
"github.com/stretchr/testify/assert"
"github.com/pushbits/server/tests"
)
func TestApi_Health(t *testing.T) {

View file

@ -5,10 +5,11 @@ import (
"io"
"testing"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
)
func TestApi_CreateNotification(t *testing.T) {

View file

@ -6,10 +6,11 @@ import (
"strconv"
"testing"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pushbits/server/internal/model"
"github.com/pushbits/server/tests"
)
func TestApi_CreateUser(t *testing.T) {

View file

@ -5,9 +5,10 @@ import (
"fmt"
"testing"
"github.com/pushbits/server/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pushbits/server/tests"
)
func TestApi_SuccessOrAbort(t *testing.T) {

View file

@ -3,6 +3,7 @@ package configuration
import (
"github.com/jinzhu/configor"
"github.com/pushbits/server/internal/log"
"github.com/pushbits/server/internal/pberrors"
)

View file

@ -7,10 +7,11 @@ import (
"testing"
"github.com/jinzhu/configor"
"github.com/pushbits/server/internal/log"
"github.com/pushbits/server/internal/pberrors"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
"github.com/pushbits/server/internal/log"
"github.com/pushbits/server/internal/pberrors"
)
type Pair struct {

View file

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/pushbits/server/internal/configuration"
)