build: Introduce Tool for OTel Engine Generation Instead of Generate File#5550
Closed
build: Introduce Tool for OTel Engine Generation Instead of Generate File#5550
Conversation
6aa1917 to
6aeece4
Compare
Base automatically changed from
blewis12/run-code-generation-automatically-for-local-alloy-build
to
main
March 11, 2026 08:54
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.
Brief description of Pull Request
The original purpose of this branch was to add a step before generating the collector that will remove all generated files so that we're generating "from scratch". This is because there have been a couple times that modifications to the
alloyandalloy_enginego.mod files have broken thego.modfile in the collector/ directory. Annoyingly, thiscollector/go.modfile has to be valid in order for the OCB generation to run to fix things - I think this is because runninggocommands first checks if the relevantgo.modfile is valid, so we run into a chicken vs egg situationThe way to avoid this is to ensure that code generation runs with a separate go.mod file, outside of the
collectordirectory. This way it doesn't matter if the collectorgo.modfile is valid or not in order to re-generate itself. This PR therefore moves the generation code intotools/generate-otel-engine-collector- which liketools/generate-module-dependenciesis implemented as a CLI tool. The steps are the exact same as before but with two differences:--from-scratchoption which is enabled by default, which will remove generated files before re-generating them to avoid invalid statesgo generateTODO:
--from-scratchor is having a separate go.mod file managing the tooling enough?