GitHub
03/12/2025, 3:39 PMgolangci-lint. This tool provides a comprehensive set of linters that catch potential issues early, enforce best practices, and reduce technical debt.
We can start with a simple linter by creating a file .golangci.yml in the root folder and put the following in the file. Simply run golangci-lint run locally.
# options for analysis running
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 5m
# exit code when at least one issue was found, default is 1
issues-exit-code: 1
linters:
enable:
- errcheck
- goconst
- goimports
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- misspell
- errorlint
- gocritic
- gofmt
We can also add the following to the pipeline to check if the code followed the linter:
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.63
args: --timeout=5m
jmpsec/osctrlGitHub
03/18/2025, 3:57 PM