Update golangci-lint to v1.42.1
This commit is contained in:
parent
e2642de2bd
commit
70f411c597
3 changed files with 39 additions and 14 deletions
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
|||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.29
|
||||
version: v1.42.1
|
||||
only-new-issues: true
|
||||
args: -c ./.golangci.yml
|
||||
skip-go-installation: true
|
||||
|
|
|
@ -1,23 +1,40 @@
|
|||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- lll
|
||||
- gochecknoinits
|
||||
- gochecknoglobals
|
||||
- cyclop
|
||||
- exhaustivestruct
|
||||
- forbidigo
|
||||
- funlen
|
||||
- whitespace
|
||||
- wsl
|
||||
- gomnd
|
||||
- goerr113
|
||||
- testpackage
|
||||
- nestif
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- gocognit
|
||||
- noctx
|
||||
- gocyclo
|
||||
- goerr113
|
||||
- gomnd
|
||||
- ifshort
|
||||
- lll
|
||||
- nestif
|
||||
- nlreturn
|
||||
- noctx
|
||||
- revive
|
||||
- testpackage
|
||||
- whitespace
|
||||
- wrapcheck
|
||||
- wsl
|
||||
|
||||
linters-settings:
|
||||
gci:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# only support one prefix
|
||||
# if not set, use goimports.local-prefixes
|
||||
local-prefixes: github.com/safing
|
||||
godox:
|
||||
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
||||
# might be left in the code accidentally and should be resolved before merging
|
||||
keywords:
|
||||
- FIXME
|
||||
gosec:
|
||||
# To specify a set of rules to explicitly exclude.
|
||||
# Available rules: https://github.com/securego/gosec#available-rules
|
||||
excludes:
|
||||
- G505 # We need crypto/sha1 for the HIBP API.
|
||||
|
|
14
test
14
test
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# config
|
||||
GOLANGCI_LINT_VERSION="1.42.1"
|
||||
|
||||
# internal variables
|
||||
warnings=0
|
||||
errors=0
|
||||
scripted=0
|
||||
|
@ -123,8 +127,8 @@ if [[ $install -eq 1 ]]; then
|
|||
echo "$ go get -u golang.org/x/lint/golint"
|
||||
go get -u golang.org/x/lint/golint
|
||||
# TODO: update golangci-lint version regularly
|
||||
echo "$ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0"
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
|
||||
echo "$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v${GOLANGCI_LINT_VERSION}"
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v${GOLANGCI_LINT_VERSION}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -146,13 +150,17 @@ if [[ $testonly -eq 0 ]]; then
|
|||
fi
|
||||
if [[ $(which golangci-lint) == "" ]]; then
|
||||
echo "golangci-lint command not found"
|
||||
echo "install with: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin vX.Y.Z"
|
||||
echo "install with: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin vX.Y.Z"
|
||||
echo "don't forget to specify the version you want"
|
||||
echo "or run: ./test install"
|
||||
echo ""
|
||||
echo "alternatively, install the current dev version with: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $(golangci-lint --version | cut -d" " -f4) != "${GOLANGCI_LINT_VERSION}" ]]; then
|
||||
echo "detected different golangci-lint version $(golangci-lint --version | cut -d" " -f4), expected configured version ${GOLANGCI_LINT_VERSION}, please fix your environment, possibly try: ./test install"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# target selection
|
||||
|
|
Loading…
Add table
Reference in a new issue