Skip to content

Commit c844dd4

Browse files
Merge pull request #121 from PDOK/jd/kubebuilder-upgrade
Kubebuilder upgrade
2 parents 5b2e3f7 + 4ca0adb commit c844dd4

34 files changed

+470
-363
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Kubebuilder DevContainer",
3-
"image": "docker.io/golang:1.24",
3+
"image": "docker.io/golang:1.25",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}

.devcontainer/post-install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22
set -x
33

4-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
4+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH)
55
chmod +x ./kind
66
mv ./kind /usr/local/bin/kind
77

8-
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
8+
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/$(go env GOARCH)
99
chmod +x kubebuilder
1010
mv kubebuilder /usr/local/bin/
1111

1212
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
13-
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
13+
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/$(go env GOARCH)/kubectl"
1414
chmod +x kubectl
1515
mv kubectl /usr/local/bin/kubectl
1616

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
22
# Ignore build and test binaries.
3-
bin/
3+
bin/

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
go-version-file: go.mod
2121

2222
- name: Run linter
23-
uses: golangci/golangci-lint-action@v6
23+
uses: golangci/golangci-lint-action@v8
2424
with:
25-
version: v1.64.8
25+
version: v2.5.0

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ jobs:
2121

2222
- name: Install the latest version of kind
2323
run: |
24-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
24+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH)
2525
chmod +x ./kind
2626
sudo mv ./kind /usr/local/bin/kind
2727
2828
- name: Verify kind installation
2929
run: kind version
3030

31-
- name: Create kind cluster
32-
run: kind create cluster
33-
3431
- name: Running Test e2e
3532
run: |
3633
go mod tidy

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ go.work
2525
*.swp
2626
*.swo
2727
*~
28+
29+
# Kubeconfig might contain secrets
30+
*.kubeconfig

.golangci.bck.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
run:
3+
# Timeout for analysis.
4+
timeout: 5m
5+
6+
# Modules download mode (do not modify go.mod)
7+
modules-download-mode: readonly
8+
9+
# Include test files (see below to exclude certain linters)
10+
tests: true
11+
12+
issues:
13+
exclude-rules:
14+
# Exclude certain linters for test code
15+
- path: "_test\\.go"
16+
linters:
17+
- bodyclose
18+
- dupl
19+
- dogsled
20+
- funlen
21+
- gosec
22+
23+
output:
24+
formats:
25+
- format: colored-line-number
26+
path: stdout
27+
print-issued-lines: true
28+
print-linter-name: true
29+
30+
linters-settings:
31+
depguard:
32+
rules:
33+
main:
34+
# Packages that are not allowed where the value is a suggestion.
35+
deny:
36+
- pkg: "github.com/pkg/errors"
37+
desc: Should be replaced by standard lib errors package
38+
cyclop:
39+
# The maximal code complexity to report.
40+
max-complexity: 15
41+
skip-tests: true
42+
funlen:
43+
lines: 100
44+
nestif:
45+
min-complexity: 6
46+
forbidigo:
47+
forbid:
48+
- http\.NotFound.* # return RFC 7807 problem details instead
49+
- http\.Error.* # return RFC 7807 problem details instead
50+
gomoddirectives:
51+
replace-allow-list:
52+
- github.com/abbot/go-http-auth # https://github.com/traefik/traefik/issues/6873#issuecomment-637654361
53+
54+
linters:
55+
disable-all: true
56+
enable:
57+
# enabled by default by golangci-lint
58+
- errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
59+
- gosimple # specializes in simplifying a code
60+
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
61+
- ineffassign # detects when assignments to existing variables are not used
62+
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
63+
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
64+
- unused # checks for unused constants, variables, functions and types
65+
# extra enabled by us
66+
- asasalint # checks for pass []any as any in variadic func(...any)
67+
- asciicheck # checks that your code does not contain non-ASCII identifiers
68+
- bidichk # checks for dangerous unicode character sequences
69+
- bodyclose # checks whether HTTP response body is closed successfully
70+
- cyclop # checks function and package cyclomatic complexity
71+
- dupl # tool for code clone detection
72+
- durationcheck # checks for two durations multiplied together
73+
- dogsled # find assignments/declarations with too many blank identifiers
74+
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
75+
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
76+
- exhaustive # checks exhaustiveness of enum switch statements
77+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
78+
- copyloopvar # checks for pointers to enclosing loop variables
79+
- fatcontext # detects nested contexts in loops and function literals
80+
- forbidigo # forbids identifiers
81+
- funlen # tool for detection of long functions
82+
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
83+
- goconst # finds repeated strings that could be replaced by a constant
84+
- gocritic # provides diagnostics that check for bugs, performance and style issues
85+
- gofmt # checks if the code is formatted according to 'gofmt' command
86+
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
87+
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
88+
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
89+
- goprintffuncname # checks that printf-like functions are named with f at the end
90+
- gosec # inspects source code for security problems
91+
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
92+
- makezero # finds slice declarations with non-zero initial length
93+
- mirror # reports wrong mirror patterns of bytes/strings usage
94+
- misspell # finds commonly misspelled English words
95+
- nakedret # finds naked returns in functions greater than a specified function length
96+
- nestif # reports deeply nested if statements
97+
- nilerr # finds the code that returns nil even if it checks that the error is not nil
98+
- nolintlint # reports ill-formed or insufficient nolint directives
99+
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
100+
- perfsprint # Golang linter for performance, aiming at usages of fmt.Sprintf which have faster alternatives
101+
- predeclared # finds code that shadows one of Go's predeclared identifiers
102+
- promlinter # checks Prometheus metrics naming via promlint
103+
- reassign # checks that package variables are not reassigned
104+
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
105+
- rowserrcheck # checks whether Err of rows is checked successfully
106+
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
107+
- sloglint # A Go linter that ensures consistent code style when using log/slog
108+
- tagliatelle # checks the struct tags.
109+
- testableexamples # checks if examples are testable (have an expected output)
110+
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
111+
- usetesting # detects using os.Setenv instead of t.Setenv since Go1.17
112+
- unconvert # removes unnecessary type conversions
113+
- unparam # reports unused function parameters
114+
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
115+
- wastedassign # finds wasted assignment statements
116+
fast: false

0 commit comments

Comments
 (0)