Skip to content

Commit 0679f99

Browse files
author
sapcc-bot
committed
Run go-makefile-maker
1 parent 6181874 commit 0679f99

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/setup-go@v5
3030
with:
3131
check-latest: true
32-
go-version: 1.24.3
32+
go-version: 1.24.4
3333
- name: Run golangci-lint
3434
uses: golangci/golangci-lint-action@v8
3535
with:

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: actions/setup-go@v5
3333
with:
3434
check-latest: true
35-
go-version: 1.24.3
35+
go-version: 1.24.4
3636
- name: Build all binaries
3737
run: make build-all
3838
test:
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/setup-go@v5
4848
with:
4949
check-latest: true
50-
go-version: 1.24.3
50+
go-version: 1.24.4
5151
- name: Run tests and generate coverage report
5252
run: make build/cover.out
5353
- name: Upload coverage report to Coveralls

.github/workflows/codeql.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: actions/setup-go@v5
3333
with:
3434
check-latest: true
35-
go-version: 1.24.3
35+
go-version: 1.24.4
3636
- name: Initialize CodeQL
3737
uses: github/codeql-action/init@v3
3838
with:

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ install-goimports: FORCE
3030
install-golangci-lint: FORCE
3131
@if ! hash golangci-lint 2>/dev/null; then printf "\e[1;36m>> Installing golangci-lint (this may take a while)...\e[0m\n"; go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest; fi
3232

33+
install-modernize: FORCE
34+
@if ! hash modernize 2>/dev/null; then printf "\e[1;36m>> Installing modernize (this may take a while)...\e[0m\n"; go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest; fi
35+
3336
install-go-licence-detector: FORCE
3437
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector (this may take a while)...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
3538

3639
install-addlicense: FORCE
3740
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense (this may take a while)...\e[0m\n"; go install github.com/google/addlicense@latest; fi
3841

39-
prepare-static-check: FORCE install-golangci-lint install-go-licence-detector install-addlicense
42+
prepare-static-check: FORCE install-golangci-lint install-modernize install-go-licence-detector install-addlicense
4043

4144
install-controller-gen: FORCE
4245
@if ! hash controller-gen 2>/dev/null; then printf "\e[1;36m>> Installing controller-gen (this may take a while)...\e[0m\n"; go install sigs.k8s.io/controller-tools/cmd/controller-gen@latest; fi
@@ -90,6 +93,10 @@ run-golangci-lint: FORCE install-golangci-lint
9093
@golangci-lint config verify
9194
@golangci-lint run
9295

96+
run-modernize: FORCE install-modernize
97+
@printf "\e[1;36m>> modernize\e[0m\n"
98+
@modernize $(GO_TESTPKGS)
99+
93100
build/cover.out: FORCE generate install-setup-envtest | build
94101
@printf "\e[1;36m>> Running tests\e[0m\n"
95102
KUBEBUILDER_ASSETS=$$(setup-envtest use 1.31 -p path) go test -shuffle=on -p 1 -coverprofile=$@ $(GO_BUILDFLAGS) -ldflags '-s -w $(GO_LDFLAGS)' -covermode=count -coverpkg=$(subst $(space),$(comma),$(GO_COVERPKGS)) $(GO_TESTPKGS)
@@ -98,7 +105,7 @@ build/cover.html: build/cover.out
98105
@printf "\e[1;36m>> go tool cover > build/cover.html\e[0m\n"
99106
@go tool cover -html $< -o $@
100107

101-
static-check: FORCE run-golangci-lint check-dependency-licenses check-license-headers
108+
static-check: FORCE run-golangci-lint run-modernize check-dependency-licenses check-license-headers
102109

103110
build:
104111
@mkdir $@
@@ -128,6 +135,10 @@ goimports: FORCE install-goimports
128135
@printf "\e[1;36m>> goimports -w -local https://github.com/sapcc/ccloud-nodeCIDR-controller\e[0m\n"
129136
@goimports -w -local github.com/sapcc/ccloud-nodeCIDR-controller $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))
130137

138+
modernize: FORCE install-modernize
139+
@printf "\e[1;36m>> modernize -fix ./...\e[0m\n"
140+
@modernize -fix ./...
141+
131142
clean: FORCE
132143
git clean -dxf build
133144

@@ -154,6 +165,7 @@ help: FORCE
154165
@printf "\e[1mPrepare\e[0m\n"
155166
@printf " \e[36minstall-goimports\e[0m Install goimports required by goimports/static-check\n"
156167
@printf " \e[36minstall-golangci-lint\e[0m Install golangci-lint required by run-golangci-lint/static-check\n"
168+
@printf " \e[36minstall-modernize\e[0m Install modernize required by modernize/static-check\n"
157169
@printf " \e[36minstall-go-licence-detector\e[0m Install-go-licence-detector required by check-dependency-licenses/static-check\n"
158170
@printf " \e[36minstall-addlicense\e[0m Install addlicense required by check-license-headers/license-headers/static-check\n"
159171
@printf " \e[36mprepare-static-check\e[0m Install any tools required by static-check. This is used in CI before dropping privileges, you should probably install all the tools using your package manager\n"
@@ -169,6 +181,7 @@ help: FORCE
169181
@printf " \e[36mcheck\e[0m Run the test suite (unit tests and golangci-lint).\n"
170182
@printf " \e[36mgenerate\e[0m Generate code for Kubernetes CRDs and deepcopy.\n"
171183
@printf " \e[36mrun-golangci-lint\e[0m Install and run golangci-lint. Installing is used in CI, but you should probably install golangci-lint using your package manager.\n"
184+
@printf " \e[36mrun-modernize\e[0m Install and run modernize. Installing is used in CI, but you should probably install modernize using your package manager.\n"
172185
@printf " \e[36mbuild/cover.out\e[0m Run tests and generate coverage report.\n"
173186
@printf " \e[36mbuild/cover.html\e[0m Generate an HTML file with source code annotations from the coverage report.\n"
174187
@printf " \e[36mstatic-check\e[0m Run static code checks\n"
@@ -179,6 +192,7 @@ help: FORCE
179192
@printf " \e[36mcheck-license-headers\e[0m Check license headers in all non-vendored .go files.\n"
180193
@printf " \e[36mcheck-dependency-licenses\e[0m Check all dependency licenses using go-licence-detector.\n"
181194
@printf " \e[36mgoimports\e[0m Run goimports on all non-vendored .go files\n"
195+
@printf " \e[36mmodernize\e[0m Run modernize on all non-vendored .go files\n"
182196
@printf " \e[36mclean\e[0m Run git clean.\n"
183197

184198
.PHONY: FORCE

0 commit comments

Comments
 (0)