mirror of https://github.com/databricks/cli.git
Add lint.sh to run golanci-lint in 2 stages (#2051)
First stage is to run goimports and formatter, second is full suite. This ensures that imports and formatting are fixed even in presence of other issues. Otherwise golanci-lint refuses to fix anything https://github.com/golangci/golangci-lint/issues/5257 This helpful when running aider with config like this - aider will use that to autofix what it can after every update: ``` % cat .aider.conf.yml lint-cmd: - "go: ./lint.sh" ```
This commit is contained in:
parent
a002475a6a
commit
e088d0d996
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ default: build
|
|||
|
||||
lint: vendor
|
||||
@echo "✓ Linting source code with https://golangci-lint.run/ (with --fix)..."
|
||||
@golangci-lint run --fix ./...
|
||||
@./lint.sh ./...
|
||||
|
||||
lintcheck: vendor
|
||||
@echo "✓ Linting source code with https://golangci-lint.run/ ..."
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# With golangci-lint, if there are any compliation issues, then formatters' autofix won't be applied.
|
||||
# https://github.com/golangci/golangci-lint/issues/5257
|
||||
# However, running goimports first alone will actually fix some of the compilation issues.
|
||||
# Fixing formatting is also reasonable thing to do.
|
||||
# For this reason, this script runs golangci-lint in two stages:
|
||||
golangci-lint run --fix --no-config --disable-all --enable gofumpt,goimports $@
|
||||
exec golangci-lint run --fix $@
|
Loading…
Reference in New Issue