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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
go-version-file: go.mod

- name: Run linter
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: v1.64.8
version: v2.12.2
71 changes: 45 additions & 26 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
version: "2"
run:
timeout: 5m
allow-parallel-runners: true

issues:
# don't skip warning about doc comments
# don't exclude the default set of lint
exclude-use-default: false
# restore some of the defaults
# (fill in the rest as needed)
exclude-rules:
- path: "api/*"
linters:
- lll
- path: "internal/*"
linters:
- dupl
- lll
linters:
disable-all: true
default: none
enable:
- copyloopvar
- dupl
- errcheck
- copyloopvar
- ginkgolinter
- goconst
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
# - lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- typecheck
- unconvert
- unparam
- unused

linters-settings:
revive:
settings:
revive:
rules:
- name: comment-spacings
staticcheck:
# v2 merged stylecheck and quickfix (QF) checks into staticcheck. The
# previous v1 config did not enable those, so restrict to the SA* checks
# to keep the lint surface equivalent to v1.64.8.
checks:
- "all"
- "-ST*"
- "-QF*"
exclusions:
generated: lax
rules:
- name: comment-spacings
- linters:
- lll
path: api/*
- linters:
- dupl
- lll
- goconst
path: internal/*
# v2 no longer applies the default exclusion of test files for goconst /
# dupl; restore that behaviour to keep parity with v1.64.8.
- linters:
- goconst
- dupl
path: _test\.go
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ Each controller uses:

## Development Environment Requirements

- **Go**: v1.24.0+ (as specified in go.mod and Dockerfile)
- **Go**: v1.26.0+ (as specified in go.mod and Dockerfile; toolchain pinned to go1.26.3)
- **Docker**: For building container images
- **Kind**: For running E2E tests locally
- **Tools**: controller-gen v0.17.2, kustomize v5.6.0, golangci-lint v1.63.4 (auto-installed via Makefile)
- **Tools**: controller-gen v0.17.2, kustomize v5.6.0, golangci-lint v2.12.2 (auto-installed via Makefile)

## Testing Strategy

Expand Down
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.24 AS builder
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.26 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -21,7 +21,15 @@ COPY internal/ internal/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
# GOEXPERIMENT=nosystemcrypto: the Microsoft Go 1.26+ base image defaults to
# GOEXPERIMENT=systemcrypto, which routes crypto/* through OpenSSL. The cgo
# variant requires CGO_ENABLED=1; the no-cgo variant (ms_nocgo_opensslcrypto)
# still dlopens libssl at runtime and therefore needs glibc's dynamic linker
# in the final image — which `distroless/minimal:3.0` does not ship, causing
# "exec /manager: no such file or directory" at container start. Disabling the
# experiment selects Go's pure-Go crypto, keeping the binary fully static and
# runnable on minimal distroless.
RUN GOEXPERIMENT=nosystemcrypto CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.2
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
GOLANGCI_LINT_VERSION ?= v1.64.8
GOLANGCI_LINT_VERSION ?= v2.12.2

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down Expand Up @@ -210,7 +210,7 @@ $(ENVTEST): $(LOCALBIN)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
Loading
Loading