Skip to content

Commit

Permalink
go/lint: add SKIP_LINTERS flag
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Mar 8, 2024
1 parent 20ed61c commit 057eab2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- `DISABLE_NILAWAY`: Set to skip running [nilaway](https://github.com/uber-go/nilaway)
- `GOLANGCI_LINTERS`: List of additional [Go linters to run with golangci-lint](https://golangci-lint.run/usage/linters/). (Example: `gosec`)
- `SKIP_GOLANGCI`: Don't run the golangci-lint checks
- `SKIP_LINTERS`: Don't run any linter (except for those specified in `EXPERIMENTAL`)
- `STRICT_GOLANGCI_LINTERS`: Enable more linters packaged with golangci-lint

### Testing
Expand Down
10 changes: 10 additions & 0 deletions go/lint-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if [[ "$OS_NAME" == "" ]]; then
export OS_NAME=linux
fi
fi

echo "running go linters for $OS_NAME"

# Check gofmt
Expand Down Expand Up @@ -130,6 +131,9 @@ run_govulncheck=true
if [[ "$DISABLE_GOVULNCHECK" != "" ]]; then
run_govulncheck=false
fi
if [[ "$SKIP_LINTERS" != "" ]]; then
run_govulncheck=false
fi
if [[ "$run_govulncheck" == "true" ]]; then
# Install the latest govulncheck release
go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down Expand Up @@ -185,6 +189,9 @@ run_xmlencoderclose=true
if [[ "$DISABLE_XMLENCODERCLOSE" != "" ]]; then
run_xmlencoderclose=false
fi
if [[ "$SKIP_LINTERS" != "" ]]; then
run_xmlencoderclose=false
fi
if [[ "$run_xmlencoderclose" == "true" ]]; then
# Install xmlencoderclose
go install github.com/adamdecaf/xmlencoderclose@latest
Expand Down Expand Up @@ -260,6 +267,9 @@ if [[ "$org" == "moov-io" ]];
then
STRICT_GOLANGCI_LINTERS=${STRICT_GOLANGCI_LINTERS:="yes"}
fi
if [[ "$SKIP_LINTERS" != "" ]]; then
disable_golangci=true
fi
if [[ "$OS_NAME" != "windows" ]]; then
if [[ "$disable_golangci" != "" ]];
then
Expand Down

0 comments on commit 057eab2

Please sign in to comment.