diff --git a/.gitignore b/.gitignore index 8e7b6987a..200ef1136 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ dnf-json local.env __debug* coverage* +/bin diff --git a/internal/clients/composer/openapi.v2.gen.go b/internal/clients/composer/openapi.v2.gen.go index 24a26e194..8f8ecb82e 100644 --- a/internal/clients/composer/openapi.v2.gen.go +++ b/internal/clients/composer/openapi.v2.gen.go @@ -1,6 +1,6 @@ // Package composer provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package composer import ( diff --git a/internal/clients/composer/package.go b/internal/clients/composer/package.go index c311fbfb6..7f3e08e8a 100644 --- a/internal/clients/composer/package.go +++ b/internal/clients/composer/package.go @@ -1,4 +1,4 @@ -//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0 --config client.cfg.yaml openapi.v2.yml +//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config client.cfg.yaml openapi.v2.yml // Generated OpenAPI clients for the Composer service. package composer diff --git a/internal/clients/content_sources/openapi.v1.gen.go b/internal/clients/content_sources/openapi.v1.gen.go index 23a31fc3c..638002e25 100644 --- a/internal/clients/content_sources/openapi.v1.gen.go +++ b/internal/clients/content_sources/openapi.v1.gen.go @@ -1,6 +1,6 @@ // Package content_sources provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package content_sources import ( diff --git a/internal/clients/content_sources/package.go b/internal/clients/content_sources/package.go index b0d272a23..9f7df469c 100644 --- a/internal/clients/content_sources/package.go +++ b/internal/clients/content_sources/package.go @@ -1,4 +1,4 @@ -//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0 --config client.cfg.yaml content-sources.v1.json +//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config client.cfg.yaml content-sources.v1.json // Generated OpenAPI clients for the Content Sources service. package content_sources diff --git a/internal/clients/provisioning/openapi.v1.gen.go b/internal/clients/provisioning/openapi.v1.gen.go index 77dd853f8..1655a6be7 100644 --- a/internal/clients/provisioning/openapi.v1.gen.go +++ b/internal/clients/provisioning/openapi.v1.gen.go @@ -1,6 +1,6 @@ // Package provisioning provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package provisioning import ( diff --git a/internal/clients/provisioning/package.go b/internal/clients/provisioning/package.go index bb2c11d4d..34cca6d13 100644 --- a/internal/clients/provisioning/package.go +++ b/internal/clients/provisioning/package.go @@ -1,4 +1,4 @@ -//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0 --config client.cfg.yml provisioning.v1.yml +//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config client.cfg.yml provisioning.v1.yml // Generated OpenAPI clients for the Provisioning service. package provisioning diff --git a/internal/clients/recommendations/openapi.v3.gen.go b/internal/clients/recommendations/openapi.v3.gen.go index 1c6fa2d5a..c368d184d 100644 --- a/internal/clients/recommendations/openapi.v3.gen.go +++ b/internal/clients/recommendations/openapi.v3.gen.go @@ -1,6 +1,6 @@ // Package recommendations provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package recommendations // GetModelVersion200Response defines model for GetModelVersion200Response. diff --git a/internal/clients/recommendations/package.go b/internal/clients/recommendations/package.go index 710eed487..7cda7ffd3 100644 --- a/internal/clients/recommendations/package.go +++ b/internal/clients/recommendations/package.go @@ -1,2 +1,2 @@ -//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0 --config client.cfg.yml recommendations.v3.json +//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config client.cfg.yml recommendations.v3.json package recommendations diff --git a/internal/v1/api.go b/internal/v1/api.go index caa40a914..c7bb4f43d 100644 --- a/internal/v1/api.go +++ b/internal/v1/api.go @@ -1,6 +1,6 @@ // Package v1 provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package v1 import ( diff --git a/internal/v1/server.go b/internal/v1/server.go index 50e312e2e..b5f8e6151 100644 --- a/internal/v1/server.go +++ b/internal/v1/server.go @@ -1,4 +1,4 @@ -//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0 --config server.cfg.yaml api.yaml +//go:generate go run -mod=mod github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config server.cfg.yaml api.yaml package v1 import ( diff --git a/tools/prepare-source.sh b/tools/prepare-source.sh index 959ecdf95..ab2d384d3 100755 --- a/tools/prepare-source.sh +++ b/tools/prepare-source.sh @@ -2,20 +2,20 @@ set -eux GO_VERSION=1.21.9 +OAPI_VERSION=2.4.1 + GO_BINARY=$(go env GOPATH)/bin/go$GO_VERSION -OAPI_VERSION=2.3.0 +TOOLS_PATH="$(realpath $(dirname "$0")/../bin)" -# this is the official way to get a different version of golang -# see https://go.dev/doc/manage-install +# Install Go SDK go install golang.org/dl/go$GO_VERSION@latest $GO_BINARY download # Ensure dev tools are installed -which goimports || $GO_BINARY install golang.org/x/tools/cmd/goimports@latest +which goimports >/dev/null || GOBIN=$TOOLS_PATH $GO_BINARY install golang.org/x/tools/cmd/goimports@latest +("$TOOLS_PATH/oapi-codegen" -version | grep "$OAPI_VERSION" >/dev/null) || GOBIN=$TOOLS_PATH $GO_BINARY install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v$OAPI_VERSION -# Ensure that all code has been regenerated from its sources with the pinned oapi version -git grep -l "go:generate.*github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" | grep -v prepare-source.sh | xargs sed -i "s|github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen[v@.0-9]*|github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v$OAPI_VERSION|g" -$GO_BINARY generate -mod=mod ./... +GOBIN=$TOOLS_PATH $GO_BINARY generate -x -mod=mod ./... # ... the code is formatted correctly, ... goimports -w internal cmd