From e4127f44024dc2d7f4fa3311e0d95e9c1867d2d8 Mon Sep 17 00:00:00 2001 From: Jian Zeng Date: Sat, 6 Jan 2024 17:22:15 +0800 Subject: [PATCH] chore: update linter config Signed-off-by: Jian Zeng --- .golangci.yml | 6 ++++++ Makefile | 6 ++++-- test/integration/sync_test.go | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 636b38b..1529035 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,6 +34,7 @@ linters: enable: - exhaustive - exportloopref + - gci - gochecknoinits - goconst - gocritic @@ -52,6 +53,11 @@ linters: - whitespace linters-settings: + gci: + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(github.com/ustclug/Yuki) exhaustive: # Only run exhaustive check on switches with "//exhaustive:enforce" comment. explicit-exhaustive-switch: true diff --git a/Makefile b/Makefile index d4a5bfb..e5672bb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: lint lint: - golangci-lint run ./... + golangci-lint run --fix ./... .PHONY: unit-test unit-test: @@ -18,6 +18,8 @@ yukid: yukictl: go build -trimpath ./cmd/yukictl +BUILD_IMAGE ?= golang:1.21-bookworm + .PHONY: yukid-linux yukid-linux: @docker run \ @@ -25,5 +27,5 @@ yukid-linux: --mount source=go-cache,destination=/root/.cache/go-build \ --mount source=go-mod,destination=/go/pkg/mod \ -v $(PWD):/app \ - golang:1.21-bookworm \ + $(BUILD_IMAGE) \ bash -c 'cd /app && make yukid' diff --git a/test/integration/sync_test.go b/test/integration/sync_test.go index 0888a96..2275c1d 100644 --- a/test/integration/sync_test.go +++ b/test/integration/sync_test.go @@ -10,10 +10,9 @@ import ( "github.com/go-resty/resty/v2" "github.com/stretchr/testify/require" - testutils "github.com/ustclug/Yuki/test/utils" - "github.com/ustclug/Yuki/pkg/api" "github.com/ustclug/Yuki/pkg/server" + testutils "github.com/ustclug/Yuki/test/utils" ) func TestSyncRepo(t *testing.T) {