mirror of
https://github.com/pushbits/server.git
synced 2025-04-29 18:26:49 +02:00
Sort imports with goimports
This commit is contained in:
parent
b0699da1e9
commit
83a9034be7
12 changed files with 29 additions and 15 deletions
9
Makefile
9
Makefile
|
@ -3,6 +3,7 @@ OUT_DIR := ./out
|
||||||
TESTS_DIR := ./tests
|
TESTS_DIR := ./tests
|
||||||
|
|
||||||
GO_FILES := $(shell find . -type f \( -iname '*.go' \))
|
GO_FILES := $(shell find . -type f \( -iname '*.go' \))
|
||||||
|
GO_MODULE := github.com/pushbits/server
|
||||||
|
|
||||||
PB_BUILD_VERSION ?= $(shell git describe --tags)
|
PB_BUILD_VERSION ?= $(shell git describe --tags)
|
||||||
ifeq ($(PB_BUILD_VERSION),)
|
ifeq ($(PB_BUILD_VERSION),)
|
||||||
|
@ -21,17 +22,18 @@ clean:
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
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 ./...
|
go vet ./...
|
||||||
misspell -error $(GO_FILES)
|
misspell -error $(GO_FILES)
|
||||||
gocyclo -over 10 $(GO_FILES)
|
gocyclo -over 10 $(GO_FILES)
|
||||||
staticcheck ./...
|
staticcheck ./...
|
||||||
errcheck -exclude errcheck_excludes.txt ./...
|
errcheck -ignoregenerated -exclude errcheck_excludes.txt ./...
|
||||||
gocritic check -disable='#experimental,#opinionated' -@ifElseChain.minThreshold 3 ./...
|
gocritic check -disable='#experimental,#opinionated' -@ifElseChain.minThreshold 3 ./...
|
||||||
revive -set_exit_status -exclude ./docs ./...
|
revive -set_exit_status -exclude ./docs ./...
|
||||||
nilaway ./...
|
nilaway ./...
|
||||||
go test -v -cover ./...
|
go test -v -cover ./...
|
||||||
gosec -exclude-dir=tests ./...
|
gosec -exclude-generated -exclude-dir=tests ./...
|
||||||
govulncheck ./...
|
govulncheck ./...
|
||||||
@printf '\n%s\n' "> Test successful"
|
@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/securego/gosec/v2/cmd/gosec@latest
|
||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
go install go.uber.org/nilaway/cmd/nilaway@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 golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
go install honnef.co/go/tools/cmd/staticcheck@latest
|
go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||||
go install mvdan.cc/gofumpt@latest
|
go install mvdan.cc/gofumpt@latest
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/api"
|
"github.com/pushbits/server/internal/api"
|
||||||
"github.com/pushbits/server/internal/authentication"
|
"github.com/pushbits/server/internal/authentication"
|
||||||
"github.com/pushbits/server/internal/log"
|
"github.com/pushbits/server/internal/log"
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/authentication/credentials"
|
"github.com/pushbits/server/internal/authentication/credentials"
|
||||||
"github.com/pushbits/server/internal/configuration"
|
"github.com/pushbits/server/internal/configuration"
|
||||||
"github.com/pushbits/server/internal/database"
|
"github.com/pushbits/server/internal/database"
|
||||||
|
|
|
@ -6,10 +6,11 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/model"
|
|
||||||
"github.com/pushbits/server/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"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
|
// Collect all created applications to check & delete them later
|
||||||
|
|
|
@ -3,12 +3,13 @@ package api
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/log"
|
"github.com/pushbits/server/internal/log"
|
||||||
"github.com/pushbits/server/internal/model"
|
"github.com/pushbits/server/internal/model"
|
||||||
"github.com/pushbits/server/tests"
|
"github.com/pushbits/server/tests"
|
||||||
"github.com/pushbits/server/tests/mockups"
|
"github.com/pushbits/server/tests/mockups"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApi_getID(t *testing.T) {
|
func TestApi_getID(t *testing.T) {
|
||||||
|
|
|
@ -3,8 +3,9 @@ package api
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pushbits/server/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/pushbits/server/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApi_Health(t *testing.T) {
|
func TestApi_Health(t *testing.T) {
|
||||||
|
|
|
@ -5,10 +5,11 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/model"
|
|
||||||
"github.com/pushbits/server/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/pushbits/server/internal/model"
|
||||||
|
"github.com/pushbits/server/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApi_CreateNotification(t *testing.T) {
|
func TestApi_CreateNotification(t *testing.T) {
|
||||||
|
|
|
@ -6,10 +6,11 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/model"
|
|
||||||
"github.com/pushbits/server/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/pushbits/server/internal/model"
|
||||||
|
"github.com/pushbits/server/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApi_CreateUser(t *testing.T) {
|
func TestApi_CreateUser(t *testing.T) {
|
||||||
|
|
|
@ -5,9 +5,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pushbits/server/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/pushbits/server/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApi_SuccessOrAbort(t *testing.T) {
|
func TestApi_SuccessOrAbort(t *testing.T) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package configuration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jinzhu/configor"
|
"github.com/jinzhu/configor"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/log"
|
"github.com/pushbits/server/internal/log"
|
||||||
"github.com/pushbits/server/internal/pberrors"
|
"github.com/pushbits/server/internal/pberrors"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,10 +7,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/jinzhu/configor"
|
"github.com/jinzhu/configor"
|
||||||
"github.com/pushbits/server/internal/log"
|
|
||||||
"github.com/pushbits/server/internal/pberrors"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
|
"github.com/pushbits/server/internal/log"
|
||||||
|
"github.com/pushbits/server/internal/pberrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Pair struct {
|
type Pair struct {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/pushbits/server/internal/configuration"
|
"github.com/pushbits/server/internal/configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue