Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2348,6 +2348,7 @@ buildvariants:
run_on:
- rhel8.7-small
expansions:
# Keep this in sync with go version used in etc/golangci-lint.sh
GO_DIST: "/opt/golang/go1.22"
tasks:
- name: ".static-analysis"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- uses: pre-commit/[email protected]
13 changes: 8 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ repos:
- id: markdown-link-check
exclude: ^(vendor)

- repo: https://github.com/golangci/golangci-lint
rev: v1.60.1
hooks:
- id: golangci-lint

- repo: local
hooks:
- id: executable-shell
name: executable-shell
entry: chmod +x
language: system
types: [shell]

- id: golangci-lint
name: golangci-lint
language: system
types: [go]
require_serial: true
pass_filenames: false
entry: etc/golangci-lint.sh
20 changes: 6 additions & 14 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ tasks:
# alignment of atomically accessed variables on 32-bit architectures (see
# https://staticcheck.io/docs/checks#SA1027)
lint:
deps: [install-golangci-lint]
cmds:
- GOOS=linux GOARCH=386 golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=arm golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=arm64 golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=amd64 golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=ppc64le golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=s390x golangci-lint run --config .golangci.yml ./...
- GOOS=linux GOARCH=386 etc/golangci-lint.sh
- GOOS=linux GOARCH=arm etc/golangci-lint.sh
- GOOS=linux GOARCH=arm64 etc/golangci-lint.sh
- GOOS=linux GOARCH=amd64 etc/golangci-lint.sh
- GOOS=linux GOARCH=ppc64le etc/golangci-lint.sh
- GOOS=linux GOARCH=s390x etc/golangci-lint.sh

update-notices: bash etc/generate_notices.pl > THIRD-PARTY-NOTICES

Expand Down Expand Up @@ -188,10 +187,3 @@ tasks:
internal: true
cmds:
- go install github.com/walle/lll/...@latest

# NOTE: A golangci-lint version is also pinned in .pre-commit-config.yaml. Make
# sure to change it there to keep it in-sync with what's used here!
install-golangci-lint:
internal: true
cmds:
- go install github.com/golangci/golangci-lint/cmd/[email protected]
18 changes: 18 additions & 0 deletions etc/golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -ex

# Unset the cross-compiler overrides while downloading binaries.
GOOS_ORIG=${GOOS:-}
export GOOS=
GOARCH_ORIG=${GOARCH:-}
export GOARCH=

# Keep this in sync with go version used in static-analysis Evergreen build variant.
go install golang.org/dl/go1.22.7@latest
go1.22.7 download
export PATH="$(go1.22.7 env GOROOT)/bin:$PATH"
go install github.com/golangci/golangci-lint/cmd/[email protected]

export GOOS=$GOOS_ORIG
export GOARCH=$GOARCH_ORIG
golangci-lint run --config .golangci.yml ./...
Loading