diff --git a/README.md b/README.md index 59cce8b..a0b8f3d 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ import _ "github.com/bool64/dev" // Include development helpers to project. Add `Makefile` to your module with includes standard targets. ```Makefile -#GOLANGCI_LINT_VERSION := "v2.11.3" # Optional configuration to pinpoint golangci-lint version. +#GOLANGCI_LINT_VERSION := "v2.15.0" # Optional configuration to pinpoint golangci-lint version. # The head of Makefile determines location of dev-go to include standard targets. GO ?= go diff --git a/makefiles/base.mk b/makefiles/base.mk index 47a73ec..f468671 100644 --- a/makefiles/base.mk +++ b/makefiles/base.mk @@ -1,4 +1,4 @@ -#GOLANGCI_LINT_VERSION := "v2.11.3" # Optional configuration to pinpoint golangci-lint version. +#GOLANGCI_LINT_VERSION := "v2.15.0" # Optional configuration to pinpoint golangci-lint version. # The head of Makefile determines location of dev-go to include standard targets. GO ?= go diff --git a/scripts/.golangci.yml b/scripts/.golangci.yml index 0a528da..263ce98 100644 --- a/scripts/.golangci.yml +++ b/scripts/.golangci.yml @@ -5,6 +5,7 @@ run: linters: default: all disable: + - exhaustruct_v5 - embeddedstructfieldcheck - nilnil - noinlineerr diff --git a/scripts/lint.sh b/scripts/lint.sh index 5608e98..a27e977 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash [ -z "$GO" ] && GO=go -[ -z "$GOLANGCI_LINT_VERSION" ] && GOLANGCI_LINT_VERSION="v2.11.3" +[ -z "$GOLANGCI_LINT_VERSION" ] && GOLANGCI_LINT_VERSION="v2.15.0" # detecting GOPATH and removing trailing "/" if any GOPATH="$(go env GOPATH)" @@ -13,7 +13,18 @@ GOPATH=${GOPATH%/} # checking if golangci-lint is available if ! command -v golangci-lint-"$GOLANGCI_LINT_VERSION" >/dev/null; then echo "Installing golangci-lint $GOLANGCI_LINT_VERSION..." - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /tmp "$GOLANGCI_LINT_VERSION" && mv /tmp/golangci-lint "$GOPATH"/bin/golangci-lint-"$GOLANGCI_LINT_VERSION" + tmp=$(mktemp -d) + ver=${GOLANGCI_LINT_VERSION#v} + name=golangci-lint-$ver-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') + url=https://github.com/golangci/golangci-lint/releases/download/$GOLANGCI_LINT_VERSION + curl -sSfL "$url/$name.tar.gz" -o "$tmp/$name.tar.gz" && + curl -sSfL "$url/golangci-lint-$ver-checksums.txt" -o "$tmp/sums" && + # anchored match: checksums also list "$name.tar.gz.sbom.json" since v2.15.0 + want=$(grep -F " $name.tar.gz" "$tmp/sums" | grep -v sbom | awk '{print $1}') && + [ "$(shasum -a 256 "$tmp/$name.tar.gz" | awk '{print $1}')" = "$want" ] && + tar -xzf "$tmp/$name.tar.gz" -C "$tmp" && + mv "$tmp/$name/golangci-lint" "$GOPATH"/bin/golangci-lint-"$GOLANGCI_LINT_VERSION" + rm -rf "$tmp" fi this_path=$(dirname "$0") diff --git a/templates/github/workflows/golangci-lint.yml b/templates/github/workflows/golangci-lint.yml index 34c9ed4..d4cb6f9 100644 --- a/templates/github/workflows/golangci-lint.yml +++ b/templates/github/workflows/golangci-lint.yml @@ -21,9 +21,9 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: stable + go-version: oldstable - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v9.2.0 + uses: golangci/golangci-lint-action@v9.3.0 with: - version: v2.11.3 + version: v2.15.0