Skip to content

Bump go and golangci-lint versions, fix lint #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
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
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'
go-version: '1.24.1'

- uses: actions/checkout@v4
with:
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'
go-version: '1.24.1'

- uses: actions/checkout@v4
with:
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'
go-version: '1.24.1'

- uses: actions/checkout@v4
with:
Expand All @@ -72,10 +72,10 @@ jobs:
# There is a risk of drift between the two, but this is only linting,
# not runtime correctness!
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
working-directory: git-sync
version: v1.59.0
version: v2.0.0

- name: make lint
working-directory: git-sync
Expand Down
54 changes: 42 additions & 12 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,55 @@
# pass, in contrast to .golangci.yaml which defines checks that also the
# existing code passes.

version: "2"

run:
timeout: 30m

linters:
disable-all: false
default: all

enable: # please keep this alphabetized
- ginkgolinter
- gocritic
- govet
- ineffassign
# Should we add logcheck, for consistency with kubernetes/kubernetes?
# - logcheck
- staticcheck
- stylecheck
- unused
- gocritic
- asasalint
- copyloopvar

disable:
- errcheck
- cyclop
- depguard
- dupl
- err113
- exhaustruct
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst # TODO: turn this one on
- gocyclo
- gosec # TODO: turn this one on
- lll
- maintidx
- mnd
- musttag
- nestif
- nlreturn
- paralleltest
- perfsprint
- promlinter
- recvcheck
- revive
- tagliatelle
- testpackage
- varnamelen
- wrapcheck
- wsl

linters-settings: # please keep this alphabetized
gocritic:
staticcheck:
checks:
- "all"
stylecheck:
settings: # please keep this alphabetized
staticcheck:
checks:
- "all"
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ IMAGE := $(REGISTRY)/$(BIN)
TAG := $(VERSION)
OS_ARCH_TAG := $(TAG)__$(OS)_$(ARCH)

BUILD_IMAGE ?= golang:1.22
BUILD_IMAGE ?= golang:1.24

DBG_MAKEFILE ?=
ifneq ($(DBG_MAKEFILE),1)
Expand Down Expand Up @@ -277,11 +277,8 @@ container-clean:
bin-clean:
rm -rf .go bin

lint-staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@2023.1.3

lint-golangci-lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.0 run
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.0 run -v

lint-shellcheck:
docker run \
Expand All @@ -292,4 +289,4 @@ lint-shellcheck:
shellcheck \
$$(git ls-files ':!:vendor' '*.sh')

lint: lint-staticcheck lint-golangci-lint lint-shellcheck
lint: lint-golangci-lint lint-shellcheck
2 changes: 1 addition & 1 deletion credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type credentialSliceValue struct {
var _ pflag.Value = &credentialSliceValue{}
var _ pflag.SliceValue = &credentialSliceValue{}

// pflagCredentialSlice is like pflag.StringSlice()
// pflagCredentialSlice is like pflag.StringSlice().
func pflagCredentialSlice(name, def, usage string) *[]credential {
p := &credentialSliceValue{}
_ = p.Set(def)
Expand Down
2 changes: 1 addition & 1 deletion env.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ type explicitFlag[T comparable] struct {
flagPtr *T
}

// newExplicitFlag allocates an explicitFlag
// newExplicitFlag allocates an explicitFlag.
func newExplicitFlag[T comparable](ptr *T, name, usage string, fn func(name string, value T, usage string) *T) {
h := &explicitFlag[T]{
realPtr: ptr,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ require (
google.golang.org/protobuf v1.33.0 // indirect
)

go 1.22
go 1.23
Loading
Loading