Skip to content

Commit 27c7848

Browse files
committed
use goderive to generate deepcopy code
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent e1496cd commit 27c7848

File tree

7 files changed

+2095
-22
lines changed

7 files changed

+2095
-22
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ test: ## Run tests
3030
fmt: ## Format go files
3131
go fmt ./...
3232

33+
.PHONY: deepcopy
34+
deepcopy:
35+
goderive -h >/dev/null 2>&1 || go install github.com/ndeloof/goderive@fcca624b32e4a982a95a6034d7627b3c6b9a674e
36+
goderive ./types/...
37+
3338
.PHONY: build-validate-image
3439
build-validate-image:
3540
docker build . -f ci/Dockerfile -t $(IMAGE_PREFIX)validate

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/go-viper/mapstructure/v2 v2.0.0
1010
github.com/google/go-cmp v0.5.9
1111
github.com/mattn/go-shellwords v1.0.12
12-
github.com/mitchellh/copystructure v1.2.0
1312
github.com/opencontainers/go-digest v1.0.0
1413
github.com/sirupsen/logrus v1.9.0
1514
github.com/stretchr/testify v1.8.4
@@ -22,7 +21,6 @@ require (
2221

2322
require (
2423
github.com/davecgh/go-spew v1.1.1 // indirect
25-
github.com/mitchellh/reflectwalk v1.0.2 // indirect
2624
github.com/pmezard/go-difflib v1.0.0 // indirect
2725
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
2826
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
1414
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1515
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
1616
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
17-
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
18-
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
19-
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
20-
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
2117
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
2218
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
2319
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

types/config.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ type Secrets map[string]SecretConfig
100100
type Configs map[string]ConfigObjConfig
101101

102102
// Extensions is a map of custom extension
103-
type Extensions map[string]interface{}
103+
type Extensions map[string]any
104+
105+
func (e Extensions) DeepCopy(t Extensions) {
106+
for k, v := range e {
107+
t[k] = v
108+
}
109+
}
104110

105111
// MarshalJSON makes Config implement json.Marshaler
106112
func (c Config) MarshalJSON() ([]byte, error) {

0 commit comments

Comments
 (0)