Skip to content

Commit 83a9034

Browse files
committed
Sort imports with goimports
1 parent b0699da commit 83a9034

File tree

12 files changed

+29
-15
lines changed

12 files changed

+29
-15
lines changed

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ OUT_DIR := ./out
33
TESTS_DIR := ./tests
44

55
GO_FILES := $(shell find . -type f \( -iname '*.go' \))
6+
GO_MODULE := github.com/pushbits/server
67

78
PB_BUILD_VERSION ?= $(shell git describe --tags)
89
ifeq ($(PB_BUILD_VERSION),)
@@ -21,17 +22,18 @@ clean:
2122

2223
.PHONY: test
2324
test:
24-
stdout=$$(gofumpt -l . 2>&1); if [ "$$stdout" ]; then exit 1; fi
25+
if [ -n "$$(gofumpt -l $(GO_FILES))" ]; then echo "Code is not properly formatted"; exit 1; fi
26+
if [ -n "$$(goimports -l -local $(GO_MODULE) $(GO_FILES))" ]; then echo "Imports are not properly formatted"; exit 1; fi
2527
go vet ./...
2628
misspell -error $(GO_FILES)
2729
gocyclo -over 10 $(GO_FILES)
2830
staticcheck ./...
29-
errcheck -exclude errcheck_excludes.txt ./...
31+
errcheck -ignoregenerated -exclude errcheck_excludes.txt ./...
3032
gocritic check -disable='#experimental,#opinionated' [email protected] 3 ./...
3133
revive -set_exit_status -exclude ./docs ./...
3234
nilaway ./...
3335
go test -v -cover ./...
34-
gosec -exclude-dir=tests ./...
36+
gosec -exclude-generated -exclude-dir=tests ./...
3537
govulncheck ./...
3638
@printf '\n%s\n' "> Test successful"
3739

@@ -45,6 +47,7 @@ setup:
4547
go install github.com/securego/gosec/v2/cmd/gosec@latest
4648
go install github.com/swaggo/swag/cmd/swag@latest
4749
go install go.uber.org/nilaway/cmd/nilaway@latest
50+
go install golang.org/x/tools/cmd/goimports@latest
4851
go install golang.org/x/vuln/cmd/govulncheck@latest
4952
go install honnef.co/go/tools/cmd/staticcheck@latest
5053
go install mvdan.cc/gofumpt@latest

internal/api/alertmanager/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/url"
77

88
"github.com/gin-gonic/gin"
9+
910
"github.com/pushbits/server/internal/api"
1011
"github.com/pushbits/server/internal/authentication"
1112
"github.com/pushbits/server/internal/log"

internal/api/api_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"testing"
77

88
"github.com/gin-gonic/gin"
9+
910
"github.com/pushbits/server/internal/authentication/credentials"
1011
"github.com/pushbits/server/internal/configuration"
1112
"github.com/pushbits/server/internal/database"

internal/api/application_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"io"
77
"testing"
88

9-
"github.com/pushbits/server/internal/model"
10-
"github.com/pushbits/server/tests"
119
"github.com/stretchr/testify/assert"
1210
"github.com/stretchr/testify/require"
11+
12+
"github.com/pushbits/server/internal/model"
13+
"github.com/pushbits/server/tests"
1314
)
1415

1516
// Collect all created applications to check & delete them later

internal/api/context_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package api
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/assert"
7+
"github.com/stretchr/testify/require"
8+
69
"github.com/pushbits/server/internal/log"
710
"github.com/pushbits/server/internal/model"
811
"github.com/pushbits/server/tests"
912
"github.com/pushbits/server/tests/mockups"
10-
"github.com/stretchr/testify/assert"
11-
"github.com/stretchr/testify/require"
1213
)
1314

1415
func TestApi_getID(t *testing.T) {

internal/api/health_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package api
33
import (
44
"testing"
55

6-
"github.com/pushbits/server/tests"
76
"github.com/stretchr/testify/assert"
7+
8+
"github.com/pushbits/server/tests"
89
)
910

1011
func TestApi_Health(t *testing.T) {

internal/api/notification_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"io"
66
"testing"
77

8-
"github.com/pushbits/server/internal/model"
9-
"github.com/pushbits/server/tests"
108
"github.com/stretchr/testify/assert"
119
"github.com/stretchr/testify/require"
10+
11+
"github.com/pushbits/server/internal/model"
12+
"github.com/pushbits/server/tests"
1213
)
1314

1415
func TestApi_CreateNotification(t *testing.T) {

internal/api/user_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"strconv"
77
"testing"
88

9-
"github.com/pushbits/server/internal/model"
10-
"github.com/pushbits/server/tests"
119
"github.com/stretchr/testify/assert"
1210
"github.com/stretchr/testify/require"
11+
12+
"github.com/pushbits/server/internal/model"
13+
"github.com/pushbits/server/tests"
1314
)
1415

1516
func TestApi_CreateUser(t *testing.T) {

internal/api/util_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import (
55
"fmt"
66
"testing"
77

8-
"github.com/pushbits/server/tests"
98
"github.com/stretchr/testify/assert"
109
"github.com/stretchr/testify/require"
10+
11+
"github.com/pushbits/server/tests"
1112
)
1213

1314
func TestApi_SuccessOrAbort(t *testing.T) {

internal/configuration/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package configuration
33

44
import (
55
"github.com/jinzhu/configor"
6+
67
"github.com/pushbits/server/internal/log"
78
"github.com/pushbits/server/internal/pberrors"
89
)

0 commit comments

Comments
 (0)