[builder] Rewrite replace paths to be absolute in generated go.mod #12638
+101
−8
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
Convert all relative paths to be absolute for
replace
directives the same way that is done for modules/components.This ensures that the
output_path
isn't tied to the location of the builder YAML config.For example:
OCB YAML -
/work/mycollector/builder.yaml
Build
cd /work/mycollector DIST_OUTPUT_PATH=/dist ocb --config ./builder.yaml
Before these changes
go.mod
's replace would end up resolving to/mylib
After these changes
go.mod
's replace resolves to/work/mylib
Link to tracking issue
n/a
Testing
Added unit test
Documentation
Copious comments in code, nothing user-facing