Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump oapi-codegen to 2.4.1 #1355

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lzap
Copy link
Collaborator

@lzap lzap commented Sep 29, 2024

Since the project relaxed the hardcoded Go requirement, we can now update. I propose to keep the pin and thus to keep updating this generator manually. Or alternatively, we can just remove the hack completely.

Quite honestly, I am not huge fan of go generate and I would suggest to get rid of it completely calling oapi-codegen directly. This is what works for us quite nicely in provisioning app (this is from makefile but you get the idea):

Copy link

codecov bot commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
internal/clients/composer/openapi.v2.gen.go 22.05% <ø> (ø)
internal/v1/api.go 47.98% <ø> (ø)
internal/v1/server.go 76.69% <ø> (ø)

mgold1234
mgold1234 previously approved these changes Oct 6, 2024
Copy link
Contributor

@mgold1234 mgold1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ezr-ondrej
Copy link
Collaborator

I'd love to get rid of the hack.
To minimize the dependencies, my vote goes to not directly depend on it. If it's not used in production code, it should not be packaged IMO :)

@lzap
Copy link
Collaborator Author

lzap commented Oct 7, 2024

I'd love to get rid of the hack.

Before we do that, I will say that the hack makes generated content more deterministic. Instead of people regenerating with effectively "random" version, we can upgrade this and create commits which will only show upgrade changes. These generator upgrades did introduce some bugs in provisioning in the past.

@lzap
Copy link
Collaborator Author

lzap commented Oct 7, 2024

How about this?

Copy link
Member

@croissanne croissanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I'm not sure what the real gain is here in changing up the tooling, I don't feel strongly either way however. But each change we'll have will need to update the individual go generate directives.

Anyway LGTM, but one comment on the use of which.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will which still work here? $TOOLS_PATH wouldn't be part of the user's path.

@lzap
Copy link
Collaborator Author

lzap commented Oct 8, 2024

But each change we'll have will need to update the individual go generate directives.

I was testing this and as far as I can tell, the tool picks the tool which is installed. I hope this will work, but it is hard to test now that there is only one release that we can use due to Go stack incompatiblity. The next update will tell. But I manually removed the version from all comment headers and the shell script does not add it back now! Looks good.

I need to figure out how to silence shellcheck on this line tho, it wants me to enquote it:

TOOLS_PATH="$(realpath $(dirname $0)/../bin)

@ezr-ondrej
Copy link
Collaborator

/retest

@lzap lzap force-pushed the unpin-oapi branch 2 times, most recently from 631c30f to 6f78dd8 Compare October 14, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants