-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27f5d4b
commit 64a2620
Showing
6 changed files
with
283 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
env: | ||
GO_VERSION: stable | ||
GOLANGCI_LINT_VERSION: v1.59 | ||
|
||
jobs: | ||
detect-modules: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
modules: ${{ steps.set-modules.outputs.modules }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- id: set-modules | ||
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT | ||
|
||
golangci: | ||
name: lint | ||
needs: detect-modules | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }} | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: golangci-lint ${{ matrix.modules }} | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
working-directory: ${{ matrix.modules }} | ||
|
||
gotest: | ||
name: tests | ||
needs: detect-modules | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }} | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Test with the Go CLI | ||
run: go test -race ${{ matrix.modules }}/... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
output: | ||
formats: | ||
- format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters-settings: | ||
gocognit: | ||
min-complexity: 10 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
gosec: | ||
excludes: | ||
# _ instead of err checks | ||
- G104 | ||
govet: | ||
enable-all: true | ||
nakedret: | ||
max-func-lines: 10 | ||
nolintlint: | ||
require-specific: true | ||
prealloc: | ||
range-loops: true | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
staticcheck: | ||
# SA5001: Allow to ignore returned error before deferring *.Close() | ||
checks: ["all", "-SA5001"] | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- gocheckcompilerdirectives | ||
- gocognit | ||
- goconst | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- makezero | ||
- mnd | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- tenv | ||
- testpackage | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- wastedassign | ||
|
||
issues: | ||
exclude-rules: | ||
- path: '(.+)_test\.go' | ||
linters: | ||
- fieldalignment | ||
- gocognit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
output: | ||
formats: | ||
- format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters-settings: | ||
gocognit: | ||
min-complexity: 10 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
gosec: | ||
excludes: | ||
# _ instead of err checks | ||
- G104 | ||
govet: | ||
enable-all: true | ||
nakedret: | ||
max-func-lines: 10 | ||
nolintlint: | ||
require-specific: true | ||
prealloc: | ||
range-loops: true | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
staticcheck: | ||
# SA5001: Allow to ignore returned error before deferring *.Close() | ||
checks: ["all", "-SA5001"] | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- gocheckcompilerdirectives | ||
- gocognit | ||
- goconst | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- makezero | ||
- mnd | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- tenv | ||
- testpackage | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- wastedassign | ||
|
||
issues: | ||
exclude-rules: | ||
- path: 'ctxkey\.go' | ||
linters: | ||
- goimports | ||
- path: '(.+)_test\.go' | ||
linters: | ||
- fieldalignment | ||
- gocognit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
go 1.20 | ||
|
||
use ( | ||
./closer | ||
./ctxkey | ||
./time | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= | ||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
output: | ||
formats: | ||
- format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters-settings: | ||
gocognit: | ||
min-complexity: 10 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
gosec: | ||
excludes: | ||
# _ instead of err checks | ||
- G104 | ||
govet: | ||
enable-all: true | ||
nakedret: | ||
max-func-lines: 10 | ||
nolintlint: | ||
require-specific: true | ||
prealloc: | ||
range-loops: true | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
staticcheck: | ||
# SA5001: Allow to ignore returned error before deferring *.Close() | ||
checks: ["all", "-SA5001"] | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- gocheckcompilerdirectives | ||
- gocognit | ||
- goconst | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- makezero | ||
- mnd | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- tenv | ||
- testpackage | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- wastedassign | ||
|
||
issues: | ||
exclude-rules: | ||
- path: '(.+)_test\.go' | ||
linters: | ||
- fieldalignment | ||
- gocognit |