Skip to content

Commit

Permalink
Use docker image instead of using curl to download and instal golangc…
Browse files Browse the repository at this point in the history
…i-lint.
  • Loading branch information
vinayakankugoyal committed Jan 5, 2022
1 parent a530c60 commit 8279ea0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ dependencies:

# golangci-lint
- name: "golangci-lint"
version: 1.42.0
version: 8d0a2ad834fe92f69fe69918a68b0c141f0ef97980e6bba84b72bdd7d58fc3b5
refPaths:
- path: hack/verify-golangci-lint.sh
match: VERSION=v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?
match: IMAGE_SHA=sha256:(8d0a2ad834fe92f69fe69918a68b0c141f0ef97980e6bba84b72bdd7d58fc3b5)

# Base images
- name: "Debian: codename (default)"
Expand Down
14 changes: 3 additions & 11 deletions hack/verify-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,12 @@ set -o errexit
set -o nounset
set -o pipefail

VERSION=v1.42.0
URL_BASE=https://raw.githubusercontent.com/golangci/golangci-lint
URL=$URL_BASE/$VERSION/install.sh
# version v1.42.0
IMAGE_SHA=sha256:8d0a2ad834fe92f69fe69918a68b0c141f0ef97980e6bba84b72bdd7d58fc3b5

if [[ ! -f .golangci.yml ]]; then
echo 'ERROR: missing .golangci.yml in repo root' >&2
exit 1
fi

if ! command -v golangci-lint; then
curl -sfL $URL | sh -s $VERSION
PATH=$PATH:bin
fi

golangci-lint version
golangci-lint linters
golangci-lint run "$@"
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint@$IMAGE_SHA golangci-lint run "$@"

0 comments on commit 8279ea0

Please sign in to comment.