Skip to content

Commit

Permalink
use goderive to generate deepcopy code
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Jun 6, 2024
1 parent e1496cd commit 9ba1fb1
Show file tree
Hide file tree
Showing 7 changed files with 2,095 additions and 22 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ test: ## Run tests
fmt: ## Format go files
go fmt ./...

.PHONY: deepcopy
deepcopy:
goderive -h >/dev/null 2>&1 || go install github.com/ndeloof/goderive@fcca624b32e4a982a95a6034d7627b3c6b9a674e
goderive ./types/...

.PHONY: build-validate-image
build-validate-image:
docker build . -f ci/Dockerfile -t $(IMAGE_PREFIX)validate
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0
github.com/google/go-cmp v0.5.9
github.com/mattn/go-shellwords v1.0.12
github.com/mitchellh/copystructure v1.2.0
github.com/opencontainers/go-digest v1.0.0
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.4
Expand All @@ -22,7 +21,6 @@ require (

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
8 changes: 7 additions & 1 deletion types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ type Secrets map[string]SecretConfig
type Configs map[string]ConfigObjConfig

// Extensions is a map of custom extension
type Extensions map[string]interface{}
type Extensions map[string]any

func (e Extensions) DeepCopy(t Extensions) {
for k, v := range e {
t[k] = v
}
}

// MarshalJSON makes Config implement json.Marshaler
func (c Config) MarshalJSON() ([]byte, error) {
Expand Down
Loading

0 comments on commit 9ba1fb1

Please sign in to comment.