diff --git a/Makefile b/Makefile index 40eef9f31..2c84d88ba 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,17 @@ PACKAGES=./acceptance/... ./libs/... ./internal/... ./cmd/... ./bundle/... . GOTESTSUM_FORMAT ?= pkgname-and-test-fails lint: - ./lint.sh ./... + golangci-lint run --fix lintcheck: golangci-lint run ./... +# Note 'make lint' will do formatting as well. However, if there are compilation errors, +# formatting/goimports will not be applied by 'make lint'. However, it will be applied by 'make fmt'. +# If you need to ensure that formatting & imports are always fixed, do "make fmt lint" +fmt: + golangci-lint run --enable-only="gofmt,gofumpt,goimports" --fix ./... + test: gotestsum --format ${GOTESTSUM_FORMAT} --no-summary=skipped -- ${PACKAGES} @@ -39,4 +45,4 @@ integration: integration-short: $(INTEGRATION) -short -.PHONY: lint lintcheck test cover showcover build snapshot vendor schema integration integration-short +.PHONY: lint lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short diff --git a/lint.sh b/lint.sh deleted file mode 100755 index 1f881eaf7..000000000 --- a/lint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -uo 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 - -golangci-lint run --fix "$@" -lint_exit_code=$? - -if [ $lint_exit_code -ne 0 ]; then - # These linters work in presence of compilation issues when run alone, so let's get these fixes at least. - golangci-lint run --enable-only="gofmt,gofumpt,goimports" --fix "$@" -fi - -exit $lint_exit_code