From 7902306919dee8ccf2acd7b5be7b2bee3b8ff840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:31:14 +0900 Subject: [PATCH 1/3] chore(ci): add lint def yaml --- .github/workflows/test_and_lint.yml | 1 - .golangci.yml | 68 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index 6010695..6b6d76e 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -39,7 +39,6 @@ jobs: - run: go generate ./... - name: Go vet run: go vet ./... - - name: GolangCI-Lint uses: golangci/golangci-lint-action@v6 with: diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a82fed1 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,68 @@ +linters-settings: + errcheck: + ignore: fmt:.*,io/ioutil:^Read.* + ignoretests: true + + goimports: + local-prefixes: github.com/LagrangeDev/LagrangeGo + +linters: + # please, do not use `enable-all`: it's deprecated and will be removed soon. + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint + disable-all: true + fast: false + enable: + - bodyclose + #- depguard + - dogsled + - errcheck + - exportloopref + - exhaustive + #- funlen + #- goconst + - gocritic + #- gocyclo + - gofmt + - goimports + - goprintffuncname + #- gosec + - gosimple + - govet + - ineffassign + #- misspell + - nolintlint + - rowserrcheck + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - whitespace + - prealloc + - predeclared + - asciicheck + - revive + - forbidigo + - makezero + + +run: + # default concurrency is a available CPU number. + # concurrency: 4 # explicitly omit this value to fully utilize available resources. + deadline: 5m + issues-exit-code: 1 + tests: false + go: '^1.23' + +# output configuration options +output: + formats: + - format: "colored-line-number" + print-issued-lines: true + print-linter-name: true + uniq-by-line: true + +issues: + # Fix found issues (if it's supported by the linter) + fix: true From 41c1780bf72621e005baa8919ee12a09432023d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:32:02 +0900 Subject: [PATCH 2/3] chore(ci): add lint def yaml --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index a82fed1..4102a2c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -53,7 +53,7 @@ run: deadline: 5m issues-exit-code: 1 tests: false - go: '^1.23' + go: '1.23' # output configuration options output: From 8c3a47b842be5f0570db0d0d495cb04fb0f0a8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:34:38 +0900 Subject: [PATCH 3/3] fix(ci): trigger lint by yml --- .github/workflows/test_and_lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index 6b6d76e..9f4355b 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -3,10 +3,12 @@ on: paths: - '**.go' - 'go.mod' + - '**.yml' pull_request: paths: - '**.go' - 'go.mod' + - '**.yml' name: Test & Lint