Repository navigation
Update Go schema and function dependencies and keep them up to date with renovate - #650
Merged
Merged
Conversation
The go function template includes go code and go.mod/go.sum files. When placed in a normal directory like the other templates, Go tools get confused since it looks like another module in the repository. To work around this, we put the go template in a tarball; however, this makes it hard to inspect and maintain. Rename the `templates/` directory to `testdata/`, which Go tooling knows to ignore. This lets us see the contents of the template and have renovate keep its dependencies current. Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
We had the go.mod and go.sum files for Go schemas defined as consts. Move them into real files so we can have renovate keep them up to date. Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Previously, we used a go template to produce go.mod for generated go functions. Use the modfile package instead, so that we can make go.mod.tmpl a valid go.mod and let renovate update it. Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Update the renovate config to update dependencies of our Go schemas and the Go function template. We can't just point renovate at it like a normal go.mod because it's not called go.mod and we still need to call it something else so Go will let us embed it. A new nix app, which renovate runs as a post-upgrade task, creates temporary modules and runs `go mod tidy` so that go.sum gets updated correctly. Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Our Go function template and schema dependencies were rather out of date. In particular, the oapi-codegen/runtime dependency prevents us from using the latest oapi-codegen in our schema generator due to some breaking changes. Manually update the direct deps to their latest versions and run the tidy-go-templates app to update indirect deps. Renovate will take care of this in the future. Unblocks crossplane#577 Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
jcogilvie
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Our Go function template and schema dependencies were rather out of date. In particular, the oapi-codegen/runtime dependency prevents us from using the latest oapi-codegen in our schema generator due to some breaking changes.
Contributing to this issue was the fact that our go.mod files were stored in a tarball (for the function template) and an in-code const (for the schemas) to avoid the Go toolchain treating them as separate modules. Move both into embeddable files by nesting them under
testdata/(so Go ignores the embedded go files) and naming the go.mod filesago.mod.tmpl. Make the function template's go.mod.tmpl a valid go module file and update it in code rather than treat it as a template, so that renovate can operate on it.Update the renovate config to update dependencies of our Go schemas and the Go function template. We can't just point renovate at it like a normal go.mod because it's not called go.mod and we still need to call it something else so Go will let us embed it. A new nix app, which renovate runs as a post-upgrade task, creates temporary modules and runs
go mod tidyso that go.sum gets updated correctly.Finally, manually update the direct dependencies and run
nix run .#tidy-go-templatesto update indirect dependencies and go.sum files. This pulls in the latest opai-codegen/runtime module, which will let us use the latest oapi-codegen generator (and unblock #577).I have:
./nix.sh flake checkto ensure this PR is ready for review.- [ ] Linked a PR or a docs tracking issue to document this change.- [ ] Addedbackport release-x.ylabels to auto-backport this PR.