Browse Source

bump golangci-lint v1.20.0

release notes:

- v1.20.0: https://github.com/golangci/golangci-lint/releases/tag/v1.20.0
    - Add WSL linter (#771)
    - Add gocognit linter (#756)
    - govet: add more analyzers
    - dramatically reduce memory usage
    - reduce 1.5x memory usage on large repos on repeated runs
    - Rename deadline option to timeout and mark deadline as deprecated
- v1.19.1: https://github.com/golangci/golangci-lint/releases/tag/v1.19.1
- v1.19.0: https://github.com/golangci/golangci-lint/releases/tag/v1.19.0
    - Add dogsled linter.
    - Add whitespace linter
    - Add Godox linter support
    - Various performance optimizations
- v1.18.0: https://github.com/golangci/golangci-lint/releases/tag/v1.18.0
    - Support go1.13
    - Update format of junit xml output to mark failures as such
    - Speed up linting: use deduplicated packages
    - Add user supplied error messages in depguard issues
    - Add funlen linter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 5 years ago
parent
commit
9cb9c6eba4
2 changed files with 14 additions and 5 deletions
  1. 10 2
      hack/dockerfile/install/golangci_lint.installer
  2. 4 3
      hack/validate/golangci-lint

+ 10 - 2
hack/dockerfile/install/golangci_lint.installer

@@ -1,11 +1,19 @@
 #!/bin/sh
 
-: "${GOLANGCI_LINT_COMMIT=v1.17.1}"
+: "${GOLANGCI_LINT_COMMIT=v1.20.0}"
 
 install_golangci_lint() {
 	echo "Installing golangci-lint version ${GOLANGCI_LINT_COMMIT}"
 	go get -d github.com/golangci/golangci-lint/cmd/golangci-lint
 	cd "$GOPATH/src/github.com/golangci/golangci-lint/" || exit 1
 	git checkout -q "${GOLANGCI_LINT_COMMIT}"
-	go build -buildmode=pie -o "${PREFIX}/golangci-lint" "github.com/golangci/golangci-lint/cmd/golangci-lint"
+
+	version="$(git describe --tags)"
+	commit="$(git rev-parse --short HEAD)"
+	commitDate="$(git show -s --format=%cd)"
+
+	go build \
+		-buildmode=pie \
+		-ldflags "-s -w -X \"main.version=${version}\" -X \"main.commit=${commit}\" -X \"main.date=${commitDate}\"" \
+		-o "${PREFIX}/golangci-lint" "github.com/golangci/golangci-lint/cmd/golangci-lint"
 }

+ 4 - 3
hack/validate/golangci-lint

@@ -6,7 +6,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 # CI platforms differ, so per-platform GOLANGCI_LINT_OPTS can be set
 # from a platform-specific Dockerfile, otherwise let's just set
 # (somewhat pessimistic) default of 10 minutes.
-: ${GOLANGCI_LINT_OPTS=--deadline=20m}
+: "${GOLANGCI_LINT_OPTS=--timeout=10m}"
 
 [ -n "${TESTDEBUG}" ] && set -x
 
@@ -18,9 +18,10 @@ elif ${PKG_CONFIG} 'libsystemd-journal' 2> /dev/null ; then
 fi
 
 # TODO use --out-format=junit-xml and store artifacts
-GOGC=20 golangci-lint run \
+# shellcheck disable=SC2086
+GOGC=75 golangci-lint run \
 	${GOLANGCI_LINT_OPTS} \
 	--print-resources-usage \
 	--build-tags="${DOCKER_BUILDTAGS}" \
 	--verbose \
-	--config ${SCRIPTDIR}/golangci-lint.yml
+	--config "${SCRIPTDIR}/golangci-lint.yml"