Skip to content

Commit 4405d16

Browse files
author
Jelle Dijkstra
committed
Ran migration to 4.6.0
1 parent 05f6a73 commit 4405d16

File tree

98 files changed

+7567
-952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+7567
-952
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": "golang:1.24",
3+
"image": "docker.io/golang:1.24",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: build
3+
env:
4+
image: pdok/atom-operator
5+
on:
6+
push:
7+
tags:
8+
- '*'
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Docker meta
14+
id: docker_meta
15+
uses: docker/metadata-action@v3
16+
with:
17+
images: ${{ env.image }}
18+
tags: |
19+
type=semver,pattern={{major}}
20+
type=semver,pattern={{major}}.{{minor}}
21+
type=semver,pattern={{version}}
22+
- name: Login to PDOK Docker Hub
23+
if: startsWith(env.image, 'pdok/')
24+
uses: docker/login-action@v1
25+
with:
26+
username: koalapdok
27+
password: ${{ secrets.DOCKERHUB_PUSH }}
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v1
30+
- name: Cache Docker layers
31+
uses: actions/cache@v4
32+
with:
33+
path: /tmp/.buildx-cache
34+
key: ${{ runner.os }}-buildx-${{ github.sha }}
35+
restore-keys: |
36+
${{ runner.os }}-buildx-
37+
- name: Build and push
38+
id: docker_build
39+
uses: docker/build-push-action@v2
40+
with:
41+
push: true
42+
tags: ${{ steps.docker_meta.outputs.tags }}
43+
labels: ${{ steps.docker_meta.outputs.labels }}
44+
cache-from: type=local,src=/tmp/.buildx-cache
45+
cache-to: type=local,dest=/tmp/.buildx-cache-new
46+
- # Temp fix to cleanup cache
47+
# https://github.com/docker/build-push-action/issues/252
48+
# https://github.com/moby/buildkit/issues/1896
49+
name: Move cache
50+
run: |
51+
rm -rf /tmp/.buildx-cache
52+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
53+
- name: Build result notification
54+
if: success() || failure()
55+
uses: 8398a7/action-slack@v3
56+
with:
57+
fields: all
58+
status: custom
59+
custom_payload: |
60+
{
61+
attachments: [{
62+
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
63+
text: `${process.env.AS_WORKFLOW} ${{ job.status }} for ${process.env.AS_REPO}!\n${process.env.AS_JOB} job on ${process.env.AS_REF} (commit: ${process.env.AS_COMMIT}, version: ${{ steps.docker_meta.outputs.version }}) by ${process.env.AS_AUTHOR} took ${process.env.AS_TOOK}`,
64+
}]
65+
}
66+
env:
67+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/test-e2e.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: E2E Tests
22

33
on:
44
push:
5+
branches:
6+
- master
57
pull_request:
68

79
jobs:

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Tests
22

33
on:
44
push:
5+
branches:
6+
- master
57
pull_request:
68

79
jobs:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ go.work
2525
*.swp
2626
*.swo
2727
*~
28+
29+
/certs

.golangci.bck.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
run:
2+
# Timeout for analysis.
3+
timeout: 5m
4+
5+
# Modules download mode (do not modify go.mod)
6+
module-download-mode: readonly
7+
8+
# Include test files (see below to exclude certain linters)
9+
tests: true
10+
11+
issues:
12+
exclude-rules:
13+
# Exclude certain linters for test code
14+
- path: "_test\\.go"
15+
linters:
16+
- bodyclose
17+
- dupl
18+
- dogsled
19+
- funlen
20+
- gosec
21+
22+
output:
23+
formats:
24+
text:
25+
path: stdout
26+
colors: true
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+
default: none
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+
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
60+
- ineffassign # detects when assignments to existing variables are not used
61+
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
62+
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
63+
- unused # checks for unused constants, variables, functions and types
64+
# extra enabled by us
65+
- asasalint # checks for pass []any as any in variadic func(...any)
66+
- asciicheck # checks that your code does not contain non-ASCII identifiers
67+
- bidichk # checks for dangerous unicode character sequences
68+
- bodyclose # checks whether HTTP response body is closed successfully
69+
- cyclop # checks function and package cyclomatic complexity
70+
- dupl # tool for code clone detection
71+
- durationcheck # checks for two durations multiplied together
72+
- dogsled # find assignments/declarations with too many blank identifiers
73+
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
74+
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
75+
- exhaustive # checks exhaustiveness of enum switch statements
76+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
77+
- copyloopvar # checks for pointers to enclosing loop variables
78+
- fatcontext # detects nested contexts in loops and function literals
79+
- forbidigo # forbids identifiers
80+
- funlen # tool for detection of long functions
81+
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
82+
- goconst # finds repeated strings that could be replaced by a constant
83+
- gocritic # provides diagnostics that check for bugs, performance and style issues
84+
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
85+
- 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
86+
- goprintffuncname # checks that printf-like functions are named with f at the end
87+
- gosec # inspects source code for security problems
88+
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
89+
- makezero # finds slice declarations with non-zero initial length
90+
- mirror # reports wrong mirror patterns of bytes/strings usage
91+
- misspell # finds commonly misspelled English words
92+
- nakedret # finds naked returns in functions greater than a specified function length
93+
- nestif # reports deeply nested if statements
94+
- nilerr # finds the code that returns nil even if it checks that the error is not nil
95+
- nolintlint # reports ill-formed or insufficient nolint directives
96+
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
97+
- perfsprint # Golang linter for performance, aiming at usages of fmt.Sprintf which have faster alternatives
98+
- predeclared # finds code that shadows one of Go's predeclared identifiers
99+
- promlinter # checks Prometheus metrics naming via promlint
100+
- reassign # checks that package variables are not reassigned
101+
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
102+
- rowserrcheck # checks whether Err of rows is checked successfully
103+
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
104+
- sloglint # A Go linter that ensures consistent code style when using log/slog
105+
- tagliatelle # checks the struct tags.
106+
- testableexamples # checks if examples are testable (have an expected output)
107+
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
108+
- usetesting # detects using os.Setenv instead of t.Setenv since Go1.17
109+
- unconvert # removes unnecessary type conversions
110+
- unparam # reports unused function parameters
111+
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
112+
- wastedassign # finds wasted assignment statements
113+
114+
formatters:
115+
enable:
116+
- gofmt # checks if the code is formatted according to 'gofmt' command
117+
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt

.golangci.yml

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,99 @@
11
version: "2"
22
run:
3-
allow-parallel-runners: true
3+
tests: true
44
linters:
5-
default: none
65
enable:
6+
- asasalint
7+
- asciicheck
8+
- bidichk
9+
- bodyclose
710
- copyloopvar
11+
- cyclop
12+
- dogsled
813
- dupl
9-
- errcheck
10-
- ginkgolinter
14+
- durationcheck
15+
- errname
16+
- errorlint
17+
- exhaustive
18+
- exptostd
19+
- fatcontext
20+
- forbidigo
21+
- funlen
22+
- gocheckcompilerdirectives
1123
- goconst
12-
- gocyclo
13-
- govet
14-
- ineffassign
15-
- lll
24+
- gocritic
25+
- gomoddirectives
26+
- gomodguard
27+
- goprintffuncname
28+
- gosec
29+
- loggercheck
30+
- makezero
31+
- mirror
1632
- misspell
1733
- nakedret
18-
- prealloc
34+
- nestif
35+
- nilerr
36+
- nolintlint
37+
- nosprintfhostport
38+
- perfsprint
39+
- predeclared
40+
- promlinter
41+
- reassign
1942
- revive
20-
- staticcheck
43+
- rowserrcheck
44+
- sloglint
45+
- sqlclosecheck
46+
- tagliatelle
47+
- testableexamples
48+
- tparallel
2149
- unconvert
2250
- unparam
23-
- unused
51+
- usestdlibvars
52+
- usetesting
53+
- wastedassign
2454
settings:
25-
revive:
55+
cyclop:
56+
max-complexity: 15
57+
depguard:
2658
rules:
27-
- name: comment-spacings
28-
- name: import-shadowing
59+
main:
60+
deny:
61+
- pkg: github.com/pkg/errors
62+
desc: Should be replaced by standard lib errors package
63+
forbidigo:
64+
forbid:
65+
- pattern: http\.NotFound.*
66+
- pattern: http\.Error.*
67+
funlen:
68+
lines: 100
69+
gomoddirectives:
70+
replace-allow-list:
71+
- github.com/abbot/go-http-auth
72+
nestif:
73+
min-complexity: 6
2974
exclusions:
3075
generated: lax
76+
presets:
77+
- comments
78+
- common-false-positives
79+
- legacy
80+
- std-error-handling
3181
rules:
3282
- linters:
33-
- lll
34-
path: api/*
35-
- linters:
83+
- bodyclose
84+
- dogsled
3685
- dupl
37-
- lll
38-
path: internal/*
86+
- funlen
87+
- gosec
88+
path: _test\.go
89+
- linters:
90+
- cyclop
91+
path: (.+)_test\.go
3992
paths:
4093
- third_party$
4194
- builtin$
4295
- examples$
4396
formatters:
44-
enable:
45-
- gofmt
46-
- goimports
4797
exclusions:
4898
generated: lax
4999
paths:

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Build the manager binary
2-
FROM golang:1.24 AS builder
2+
FROM docker.io/golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

66
WORKDIR /workspace
77
# Copy the Go Modules manifests
88
COPY go.mod go.mod
99
COPY go.sum go.sum
10+
1011
# cache deps before building and copying source so that we don't need to re-download as much
1112
# and so that source changes don't invalidate our downloaded layer
1213
RUN go mod download

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Publieke Dienstverlening op de Kaart
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)