Skip to content

Commit

Permalink
Fix up linting tools (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo authored Oct 26, 2022
1 parent acea7f9 commit a12c199
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 72 deletions.
86 changes: 73 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,85 @@ on:
- main

jobs:
test:
runs-on: ubuntu-latest
lint:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2
- uses: 'actions/checkout@v3'

- uses: actions/setup-go@v2
- uses: 'actions/setup-go@v3'
with:
go-version: '1.14'

- uses: actions/cache@v2
- uses: 'golangci/golangci-lint-action@v3'
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
version: 'v1.50.1'
only-new-issues: true
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
args: >-
--enable=${{ join(fromJson('[
"asciicheck",
"bidichk",
"bodyclose",
"containedctx",
"depguard",
"dogsled",
"errcheck",
"errchkjson",
"errname",
"errorlint",
"exhaustive",
"exportloopref",
"forcetypeassert",
"godot",
"gofumpt",
"goheader",
"goimports",
"gomodguard",
"goprintffuncname",
"gosec",
"gosimple",
"govet",
"ifshort",
"ineffassign",
"makezero",
"noctx",
"nolintlint",
"prealloc",
"predeclared",
"revive",
"sqlclosecheck",
"staticcheck",
"stylecheck",
"tenv",
"thelper",
"tparallel",
"typecheck",
"unconvert",
"unused",
"whitespace",
]'), ',') }}
--max-issues-per-linter=0
--max-same-issues=0
--timeout=5m
test:
strategy:
matrix:
platform:
- 'macos-latest'
- 'ubuntu-latest'
- 'windows-latest'

runs-on: '${{ matrix.platform }}'

- name: Lint
run: make fmtcheck staticcheck spellcheck
steps:
- uses: 'actions/checkout@v3'

- uses: 'actions/setup-go@v3'
with:
go-version: '1.14'

- name: Test
run: make test-acc
- run: 'make test-acc'
119 changes: 119 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
run:
# default: '1m'
timeout: '5m'

# default: []
build-tags: []

# default: ''
modules-download-mode: 'readonly'

# default: false
allow-parallel-runners: true

linters:
enable:
- 'asasalint'
- 'asciicheck'
- 'bidichk'
- 'bodyclose'
- 'containedctx'
- 'contextcheck'
- 'cyclop'
- 'decorder'
- 'depguard'
- 'dogsled'
- 'dupl'
- 'dupword'
- 'durationcheck'
- 'errcheck'
- 'errchkjson'
- 'errname'
- 'errorlint'
- 'execinquery'
- 'exhaustive'
- 'exhaustruct'
- 'exportloopref'
- 'forbidigo'
- 'forcetypeassert'
- 'funlen'
- 'gci'
- 'gochecknoglobals'
- 'gochecknoinits'
- 'gocognit'
- 'goconst'
- 'gocritic'
- 'gocyclo'
- 'godot'
- 'godox'
- 'goerr113'
- 'gofumpt'
- 'goheader'
- 'goimports'
- 'gomnd'
- 'gomoddirectives'
- 'gomodguard'
- 'goprintffuncname'
- 'gosec'
- 'gosimple'
- 'govet'
- 'grouper'
- 'importas'
- 'ineffassign'
- 'interfacebloat'
- 'ireturn'
- 'lll'
- 'loggercheck'
- 'maintidx'
- 'makezero'
- 'misspell'
- 'nakedret'
- 'nestif'
- 'nilerr'
- 'nilnil'
- 'nlreturn'
- 'noctx'
- 'nolintlint'
- 'nonamedreturns'
- 'nosprintfhostport'
- 'paralleltest'
- 'prealloc'
- 'predeclared'
- 'promlinter'
- 'reassign'
- 'revive'
- 'rowserrcheck'
- 'sqlclosecheck'
- 'staticcheck'
- 'stylecheck'
- 'tagliatelle'
- 'tenv'
- 'testableexamples'
- 'testpackage'
- 'thelper'
- 'tparallel'
- 'typecheck'
- 'unconvert'
- 'unparam'
- 'unused'
- 'usestdlibvars'
- 'varnamelen'
- 'wastedassign'
- 'whitespace'
- 'wrapcheck'
- 'wsl'

issues:
# default: []
exclude:
- '^SA3000:' # staticcheck: not required in Go 11.4+

# default: 50
max-issues-per-linter: 0

# default: 3
max-same-issues: 0

severity:
# default: ''
default-severity: error
10 changes: 0 additions & 10 deletions tools/go.mod

This file was deleted.

39 changes: 0 additions & 39 deletions tools/go.sum

This file was deleted.

10 changes: 0 additions & 10 deletions tools/tools.go

This file was deleted.

0 comments on commit a12c199

Please sign in to comment.