-
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.
Merge pull request #2 from sshaplygin/add-lint
add: golangci lint
- Loading branch information
Showing
10 changed files
with
200 additions
and
38 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,28 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
pull_request: | ||
permissions: | ||
contents: read | ||
defaults: | ||
run: | ||
shell: bash | ||
concurrency: | ||
group: lint-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
golangci-lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.45 | ||
only-new-issues: true | ||
timeout-minutes: 5 |
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,65 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
pull_request: | ||
permissions: | ||
contents: read | ||
defaults: | ||
run: | ||
shell: bash | ||
concurrency: | ||
group: test-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test: | ||
name: Unit | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
matrix: | ||
go: [ "1.18", "1.17", "1.16", "1.15", "1.14", "1.13" ] | ||
os: [ ubuntu, windows, macos ] | ||
fail-fast: false | ||
env: | ||
GO111MODULE: "on" | ||
GOFLAGS: "-mod=readonly" | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v2 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
# * Build cache (Windows) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go }}- | ||
${{ runner.os }}-go- | ||
- name: Build | ||
run: go build ./... | ||
- name: Vet | ||
run: go vet ./... | ||
- name: Check go.mod Tidiness | ||
run: go mod tidy -go=1.18 -compat=1.16 && git diff --exit-code | ||
if: ${{ matrix.go == '1.18' }} | ||
- name: Test | ||
run: go test -count=1 ./... | ||
- name: Test (race) | ||
run: go test -count=1 -race ./... | ||
# The race detector adds considerable runtime overhead. To save time on | ||
# pull requests, only run this step for a single job in the matrix. For | ||
# all other workflow triggers (e.g., pushes to a release branch) run | ||
# this step for the whole matrix. | ||
if: ${{ github.event_name != 'pull_request' || (matrix.go == '1.18' && matrix.os == 'ubuntu') }} | ||
timeout-minutes: 5 |
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,68 @@ | ||
# More info on config here: https://github.com/golangci/golangci-lint#config-file | ||
run: | ||
deadline: 5m | ||
issues-exit-code: 1 | ||
tests: true | ||
modules-download-mode: mod | ||
skip-dirs-use-default: true | ||
skip-dirs: | ||
- bin | ||
- vendor | ||
- tests | ||
|
||
output: | ||
format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters-settings: | ||
govet: | ||
check-shadowing: true | ||
golint: | ||
min-confidence: 0 | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
|
||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- gofmt | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- whitespace | ||
|
||
issues: | ||
exclude-use-default: false | ||
exclude: | ||
# ST1003: method parameter userId should be userID (stylecheck) | ||
- ST1003 | ||
- ST1000 |
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package go_socket_io_redis_adapter | ||
package go_socketio_redis_adapter | ||
|
||
import "github.com/gofrs/uuid" | ||
|
||
|
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
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
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