Conversation
|
|
Actually yeah, the backport would fail because this PR wasn't back ported. I actually think that PR should be back ported since we'll start getting some merge conflicts if not, and it's not actually exposing any features but includes internal build changes (looking at the guide here) Gonna create a PR for that first edit: meh, can't really backport the otel engine build changes because they're dependent on the prometheus upgrade. maybe this can wait until the next release, but gonna talk to Joe later today to make sure i'm not missing something |
This PR addresses an edge case in the collector generation:
It could be that a dependency in the collector that has been brought in transitively through either
alloyoralloyenginehas been updated inalloy/alloyenginego mod file. This leads us to the state where:generator.gofilego mod tidyneeds to be runAs a real-life example, if you run:
in the alloyengine module, and then attempt to build/generate the collector. You will run into the following error
This is sort of a chicken and egg situation, since the generator is what outputs the go.mod file, but the go.mod file needs to be tidy in order for the generation script to even run.
To get around this for now, we can check for the existence of a go.mod file in the collector directory, and if it exists then run
go mod tidyas a pre-step to the generation step. I have added the check for the go.mod file, since technically it should be possible to generate the code completely from scratch (ie no existing go.mod file), and if we rungo mod tidywhen there is nogo.modfile present, we get an error.