Skip to content

Commit 9387750

Browse files
committed
run 'make upgrade-klone' and 'make generate'
Signed-off-by: Tim Ramlot <[email protected]>
1 parent 11a2dbd commit 9387750

File tree

14 files changed

+110
-593
lines changed

14 files changed

+110
-593
lines changed

.golangci.yaml

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
1-
issues:
2-
exclude-rules:
3-
- linters:
4-
- bodyclose
5-
- dupword
6-
- errcheck
7-
- errchkjson
8-
- forbidigo
9-
- gci
10-
- gocritic
11-
- gofmt
12-
- gosec
13-
- gosimple
14-
- govet
15-
- misspell
16-
- musttag
17-
- nilerr
18-
- staticcheck
19-
- noctx
20-
- unconvert
21-
- unparam
22-
- usestdlibvars
23-
- predeclared
24-
text: ".*"
1+
version: "2"
252
linters:
26-
# Explicitly define all enabled linters
27-
disable-all: true
3+
default: none
4+
exclusions:
5+
generated: lax
6+
presets: [comments, common-false-positives, legacy, std-error-handling]
7+
rules:
8+
- linters:
9+
- bodyclose
10+
- dupword
11+
- errcheck
12+
- errchkjson
13+
- forbidigo
14+
- gocritic
15+
- gosec
16+
- govet
17+
- misspell
18+
- musttag
19+
- nilerr
20+
- noctx
21+
- predeclared
22+
- staticcheck
23+
- unconvert
24+
- unparam
25+
- usestdlibvars
26+
text: .*
27+
paths: [third_party$, builtin$, examples$]
28+
warn-unused: true
29+
settings:
30+
staticcheck:
31+
checks: ["all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008"]
2832
enable:
2933
- asasalint
3034
- asciicheck
3135
- bidichk
3236
- bodyclose
37+
- canonicalheader
3338
- contextcheck
3439
- copyloopvar
3540
- decorder
@@ -40,23 +45,22 @@ linters:
4045
- errchkjson
4146
- errname
4247
- exhaustive
48+
- exptostd
4349
- forbidigo
44-
- gci
4550
- ginkgolinter
4651
- gocheckcompilerdirectives
4752
- gochecksumtype
4853
- gocritic
49-
- gofmt
5054
- goheader
5155
- goprintffuncname
5256
- gosec
53-
- gosimple
5457
- gosmopolitan
5558
- govet
5659
- grouper
5760
- importas
5861
- ineffassign
5962
- interfacebloat
63+
- intrange
6064
- loggercheck
6165
- makezero
6266
- mirror
@@ -74,19 +78,23 @@ linters:
7478
- sloglint
7579
- staticcheck
7680
- tagalign
77-
- tenv
7881
- testableexamples
79-
- typecheck
8082
- unconvert
8183
- unparam
8284
- unused
8385
- usestdlibvars
86+
- usetesting
8487
- wastedassign
85-
linters-settings:
86-
gci:
87-
sections:
88-
- standard # Standard section: captures all standard packages.
89-
- default # Default section: contains all imports that could not be matched to another section type.
90-
- prefix(github.com/jetstack/preflight) # Custom section: groups all imports with the specified Prefix.
91-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
92-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
88+
formatters:
89+
enable: [gci, gofmt]
90+
settings:
91+
gci:
92+
sections:
93+
- standard # Standard section: captures all standard packages.
94+
- default # Default section: contains all imports that could not be matched to another section type.
95+
- prefix(github.com/jetstack/preflight) # Custom section: groups all imports with the specified Prefix.
96+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
97+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
98+
exclusions:
99+
generated: lax
100+
paths: [third_party$, builtin$, examples$]

klone.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ targets:
1010
- folder_name: generate-verify
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
13+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
1414
repo_path: modules/generate-verify
1515
- folder_name: go
1616
repo_url: https://github.com/cert-manager/makefile-modules.git
1717
repo_ref: main
18-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
18+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
1919
repo_path: modules/go
2020
- folder_name: helm
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
23+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
2424
repo_path: modules/helm
2525
- folder_name: help
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
28+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
2929
repo_path: modules/help
3030
- folder_name: kind
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
33+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
3434
repo_path: modules/kind
3535
- folder_name: klone
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
38+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
3939
repo_path: modules/klone
4040
- folder_name: oci-build
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
43+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
4444
repo_path: modules/oci-build
4545
- folder_name: oci-publish
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
48+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
4949
repo_path: modules/oci-publish
5050
- folder_name: repository-base
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
53+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
5454
repo_path: modules/repository-base
5555
- folder_name: tools
5656
repo_url: https://github.com/cert-manager/makefile-modules.git
5757
repo_ref: main
58-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
58+
repo_hash: 63de69c93b4abd5f087b5ec9e845ac901334f3f4
5959
repo_path: modules/tools

make/_shared/generate-verify/util/verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ trap "cleanup" EXIT SIGINT
5353
# 2. rsync on macOS 15.4 and newer is actually openrsync, which has different permissions and throws errors when copying git objects
5454
#
5555
# So, we use find to list all files except _bin, and then copy each in turn
56-
find . -maxdepth 1 -not \( -path "./_bin" -prune \) | xargs -I% cp -af "${projectdir}/%" "${tmp}/"
56+
find . -maxdepth 1 -not \( -path "./_bin" \) -not \( -path "." \) | xargs -I% cp -af "${projectdir}/%" "${tmp}/"
5757

5858
pushd "${tmp}" >/dev/null
5959

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
version: "2"
12
linters:
2-
# Explicitly define all enabled linters
3-
disable-all: true
3+
default: none
4+
exclusions:
5+
generated: lax
6+
presets: [ comments, common-false-positives, legacy, std-error-handling ]
7+
paths: [ third_party$, builtin$, examples$ ]
8+
warn-unused: true
9+
settings:
10+
staticcheck:
11+
checks: [ "all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008" ]
412
enable:
513
- asasalint
614
- asciicheck
715
- bidichk
816
- bodyclose
17+
- canonicalheader
918
- contextcheck
1019
- copyloopvar
1120
- decorder
@@ -16,23 +25,22 @@ linters:
1625
- errchkjson
1726
- errname
1827
- exhaustive
28+
- exptostd
1929
- forbidigo
20-
- gci
2130
- ginkgolinter
2231
- gocheckcompilerdirectives
2332
- gochecksumtype
2433
- gocritic
25-
- gofmt
2634
- goheader
2735
- goprintffuncname
2836
- gosec
29-
- gosimple
3037
- gosmopolitan
3138
- govet
3239
- grouper
3340
- importas
3441
- ineffassign
3542
- interfacebloat
43+
- intrange
3644
- loggercheck
3745
- makezero
3846
- mirror
@@ -50,19 +58,23 @@ linters:
5058
- sloglint
5159
- staticcheck
5260
- tagalign
53-
- tenv
5461
- testableexamples
55-
- typecheck
5662
- unconvert
5763
- unparam
5864
- unused
5965
- usestdlibvars
66+
- usetesting
6067
- wastedassign
61-
linters-settings:
62-
gci:
63-
sections:
64-
- standard # Standard section: captures all standard packages.
65-
- default # Default section: contains all imports that could not be matched to another section type.
66-
- prefix({{REPO-NAME}}) # Custom section: groups all imports with the specified Prefix.
67-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
68-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
68+
formatters:
69+
enable: [ gci, gofmt ]
70+
settings:
71+
gci:
72+
sections:
73+
- standard # Standard section: captures all standard packages.
74+
- default # Default section: contains all imports that could not be matched to another section type.
75+
- prefix({{REPO-NAME}}) # Custom section: groups all imports with the specified Prefix.
76+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
77+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
78+
exclusions:
79+
generated: lax
80+
paths: [ third_party$, builtin$, examples$ ]

make/_shared/go/01_mod.mk

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ ifdef golangci_lint_config
101101
.PHONY: generate-golangci-lint-config
102102
## Generate a golangci-lint configuration file
103103
## @category [shared] Generate/ Verify
104-
generate-golangci-lint-config: | $(NEEDS_YQ) $(bin_dir)/scratch
104+
generate-golangci-lint-config: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir)/scratch
105+
if [ "$$($(YQ) eval 'has("version") | not' $(golangci_lint_config))" == "true" ]; then \
106+
$(GOLANGCI-LINT) migrate -c $(golangci_lint_config); \
107+
rm $(basename $(golangci_lint_config)).bck$(suffix $(golangci_lint_config)); \
108+
fi
109+
105110
cp $(golangci_lint_config) $(bin_dir)/scratch/golangci-lint.yaml.tmp
106111
$(YQ) -i 'del(.linters.enable)' $(bin_dir)/scratch/golangci-lint.yaml.tmp
107112
$(YQ) eval-all -i '. as $$item ireduce ({}; . * $$item)' $(bin_dir)/scratch/golangci-lint.yaml.tmp $(golangci_lint_override)
@@ -119,9 +124,9 @@ verify-golangci-lint: | $(NEEDS_GO) $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir
119124
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
120125
| while read d; do \
121126
target=$$(dirname $${d}); \
122-
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout)' in directory '$${target}'"; \
127+
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint run -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout)' in directory '$${target}'"; \
123128
pushd "$${target}" >/dev/null; \
124-
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout) || exit; \
129+
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) run -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout) || exit; \
125130
popd >/dev/null; \
126131
echo ""; \
127132
done
@@ -132,21 +137,12 @@ shared_verify_targets_dirty += verify-golangci-lint
132137
## Fix all Go modules using golangci-lint
133138
## @category [shared] Generate/ Verify
134139
fix-golangci-lint: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(NEEDS_GCI) $(bin_dir)/scratch
135-
$(GCI) write \
136-
--skip-generated \
137-
--skip-vendor \
138-
-s "standard" \
139-
-s "default" \
140-
-s "prefix($(repo_name))" \
141-
-s "blank" \
142-
-s "dot" .
143-
144140
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
145141
| while read d; do \
146142
target=$$(dirname $${d}); \
147-
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix' in directory '$${target}'"; \
143+
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint fmt -c $(CURDIR)/$(golangci_lint_config)' in directory '$${target}'"; \
148144
pushd "$${target}" >/dev/null; \
149-
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix || exit; \
145+
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) fmt -c $(CURDIR)/$(golangci_lint_config) || exit; \
150146
popd >/dev/null; \
151147
echo ""; \
152148
done

make/_shared/kind/kind-image-preload.mk

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,14 @@ images_tars := $(images_files:%=$(images_tar_dir)/%.tar)
4646
# tag to point to a different digest. This prevents CI from breaking due to upstream
4747
# changes. However, it also means that we can incorrectly combine digests with tags,
4848
# hence caution is advised.
49-
$(images_tars): $(images_tar_dir)/%.tar: | $(NEEDS_CRANE) $(NEEDS_GOJQ)
49+
$(images_tars): $(images_tar_dir)/%.tar: | $(NEEDS_IMAGE-TOOL) $(NEEDS_CRANE) $(NEEDS_GOJQ)
5050
@$(eval full_image=$(subst +,:,$*))
5151
@$(eval bare_image=$(word 1,$(subst :, ,$(full_image))))
5252
@$(eval digest=$(word 2,$(subst @, ,$(full_image))))
5353
@$(eval tag=$(word 2,$(subst :, ,$(word 1,$(subst @, ,$(full_image))))))
54-
@mkdir -p $@.tmp.unpacked
55-
$(CRANE) pull "$(bare_image)@$(digest)" $@.tmp --platform=linux/$(HOST_ARCH)
56-
@tar xf $@.tmp -C $@.tmp.unpacked
57-
@rm -rf $@.tmp
58-
@$(GOJQ) '.[0].RepoTags[0] |= rtrimstr("i-was-a-digest") + "$(tag)"' $@.tmp.unpacked/manifest.json > $@.tmp.unpacked/manifest.json.new
59-
@mv $@.tmp.unpacked/manifest.json.new $@.tmp.unpacked/manifest.json
60-
@find $@.tmp.unpacked \( -type f -o -type d \) -printf "%P\n" | tar -cf $@ --no-recursion -C $@.tmp.unpacked -T -
61-
@rm -rf $@.tmp.unpacked
54+
@mkdir -p $(dir $@)
55+
$(CRANE) pull "$(bare_image)@$(digest)" $@ --platform=linux/$(HOST_ARCH)
56+
$(IMAGE-TOOL) tag-docker-tar $@ "$(bare_image):$(tag)"
6257

6358
images_tar_envs := $(images_files:%=env-%)
6459

0 commit comments

Comments
 (0)