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
|
- name: Run golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v2
|
||||||
with:
|
with:
|
||||||
version: v1.29
|
version: v1.42.1
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
args: -c ./.golangci.yml
|
args: -c ./.golangci.yml
|
||||||
skip-go-installation: true
|
skip-go-installation: true
|
||||||
|
|
|
@ -1,23 +1,40 @@
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
enable-all: true
|
||||||
disable:
|
disable:
|
||||||
- lll
|
- cyclop
|
||||||
- gochecknoinits
|
- exhaustivestruct
|
||||||
- gochecknoglobals
|
- forbidigo
|
||||||
- funlen
|
- funlen
|
||||||
- whitespace
|
- gochecknoglobals
|
||||||
- wsl
|
- gochecknoinits
|
||||||
- gomnd
|
|
||||||
- goerr113
|
|
||||||
- testpackage
|
|
||||||
- nestif
|
|
||||||
- gocognit
|
- gocognit
|
||||||
- noctx
|
|
||||||
- gocyclo
|
- gocyclo
|
||||||
|
- goerr113
|
||||||
|
- gomnd
|
||||||
|
- ifshort
|
||||||
|
- lll
|
||||||
|
- nestif
|
||||||
|
- nlreturn
|
||||||
|
- noctx
|
||||||
|
- revive
|
||||||
|
- testpackage
|
||||||
|
- whitespace
|
||||||
|
- wrapcheck
|
||||||
|
- wsl
|
||||||
|
|
||||||
linters-settings:
|
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:
|
godox:
|
||||||
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
# 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
|
# might be left in the code accidentally and should be resolved before merging
|
||||||
keywords:
|
keywords:
|
||||||
- FIXME
|
- 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
|
#!/bin/bash
|
||||||
|
|
||||||
|
# config
|
||||||
|
GOLANGCI_LINT_VERSION="1.42.1"
|
||||||
|
|
||||||
|
# internal variables
|
||||||
warnings=0
|
warnings=0
|
||||||
errors=0
|
errors=0
|
||||||
scripted=0
|
scripted=0
|
||||||
|
@ -123,8 +127,8 @@ if [[ $install -eq 1 ]]; then
|
||||||
echo "$ go get -u golang.org/x/lint/golint"
|
echo "$ go get -u golang.org/x/lint/golint"
|
||||||
go get -u golang.org/x/lint/golint
|
go get -u golang.org/x/lint/golint
|
||||||
# TODO: update golangci-lint version regularly
|
# 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"
|
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 -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -146,13 +150,17 @@ if [[ $testonly -eq 0 ]]; then
|
||||||
fi
|
fi
|
||||||
if [[ $(which golangci-lint) == "" ]]; then
|
if [[ $(which golangci-lint) == "" ]]; then
|
||||||
echo "golangci-lint command not found"
|
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 "don't forget to specify the version you want"
|
||||||
echo "or run: ./test install"
|
echo "or run: ./test install"
|
||||||
echo ""
|
echo ""
|
||||||
echo "alternatively, install the current dev version with: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint"
|
echo "alternatively, install the current dev version with: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
fi
|
||||||
|
|
||||||
# target selection
|
# target selection
|
||||||
|
|
Loading…
Add table
Reference in a new issue