-
Notifications
You must be signed in to change notification settings - Fork 223
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
Added test to check forgotten codegen updates. #427
Conversation
In PR #388, we changed `weaver generate` to embed listener information in compiled Service Weaver binaries. This change landed in v0.15.0. However, we forgot to update the codegen version. This led to the following bug, reported by @renanbastos93 in the Discord: - Run `weaver generate` at version v0.14.0. - Run `go run .` at version v0.16.1. - The app crashes looking for listener information in the binary, but the information is not there because of the stale `weaver generate`. If we had updated the codegen version, then the code would not have compiled, and the user would have received an error message explaining that they needed to update `weaver generate`. It's really easy to forget to update the codegen version, so I added a unit test that checks for changes to how weaver_gen.go files are generated. If there is any change, the test fails and you're prompted to update the codegen version.
This PR adds a test that fails when you forget to update the deployer API version. See PR #427 for more context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing!
This PR adds a test that fails when you forget to update the deployer API version. See PR #427 for more context.
This PR adds a test that fails when you forget to update the deployer API version. See PR #427 for more context.
I chatted with Sanjay about this test a bit. An alternative is to have a separate script that compares the value of the The tricky thing is that some changes to |
In PR #388, we changed
weaver generate
to embed listener information in compiled Service Weaver binaries. This change landed in v0.15.0. However, we forgot to update the codegen version. This led to the following bug, reported by @renanbastos93 in the Discord:weaver generate
at version v0.14.0.go run .
at version v0.16.1.weaver generate
.If we had updated the codegen version, then the code would not have compiled, and the user would have received an error message explaining that they needed to update
weaver generate
.It's really easy to forget to update the codegen version, so I added a unit test that checks for changes to how
weaver_gen.go
files are generated. If there is any change, the test fails and you're prompted to update the codegen version.