opentelemetry-collector
opentelemetry-collector copied to clipboard
[builder] Support for --skip-new-go-module
A continuation of https://github.com/open-telemetry/opentelemetry-collector/pull/9253
Description: Adds a --skip-new-go-module flag to the OTC builder. This enables users working in an existing go module environment (say, a "monorepo") to update the module they have, vs forcing the use of a new module.
With the new support inside an existing Go module, a collector main package can be generated using a go:generate directive. For example, in the directory where I want my collector built, the file generate.go has this line:
//go:generate builder --skip-new-go-module --skip-compilation --strict-versioning --config=./build-config.yaml In the same directory, the build-config.yaml describes the collector to build. The builder generates the other files in the same directory. At this point, normal Go workflows can be used to update indirect dependencies. The optional --strict-versioning checks that the build configuration matches that resulting from the enclosing Go module.
Link to tracking Issue: https://github.com/open-telemetry/opentelemetry-collector/issues/9252
Testing: Unit tests added.
Documentation: Yes.
Codecov Report
Attention: Patch coverage is 55.08982% with 75 lines in your changes are missing coverage. Please review.
Project coverage is 90.71%. Comparing base (
b8690b6) to head (b7d0161). Report is 76 commits behind head on main.
:exclamation: Current head b7d0161 differs from pull request most recent head cedc4bc. Consider uploading reports for the commit cedc4bc to get more accurate results
| Files | Patch % | Lines |
|---|---|---|
| cmd/builder/internal/builder/main.go | 49.26% | 54 Missing and 15 partials :warning: |
| cmd/builder/internal/command.go | 25.00% | 4 Missing and 2 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #9631 +/- ##
==========================================
- Coverage 91.34% 90.71% -0.63%
==========================================
Files 357 353 -4
Lines 19196 18773 -423
==========================================
- Hits 17534 17030 -504
- Misses 1334 1403 +69
- Partials 328 340 +12
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Discussed at the collector sig meeting today - I will look into splitting up the strict versioning and skip new go module flag additions into their own PRs.
I will look into splitting up the strict versioning and skip new go module flag additions into their own PRs.
Please ping me directly once you have them ready, I'll review the PRs.
This PR was marked stale due to lack of activity. It will be closed in 14 days.
I'll be rebasing this and adding tests tonight.
Declaring PR bankruptcy and trying again here.