Builder support to create a module instead of main binary
Is your feature request related to a problem? Please describe.
Currently, the OTel Collector Builder produces a main binary. While it is possible to skip compilation with --skip-compilation, it still generates main files, and the package name for the generated files is main.
In certain scenarios, it would be helpful if the builder supported a mode where it only generates a Go module instead of a main binary. This would allow the collector to be more easily integrated into an existing Go program. For example, at Elastic, we embed our Collector Distribution into Elastic Agent as a subcommand elastic-agent otel.
Describe the solution you'd like
I suggest adding a new flag or config.yml property to instruct the Builder to create a module instead of a main binary. When this option is provided, the Builder would skip generating the main files and instead export an entry point that can be used as a library.
Source: open-telemetry/opentelemetry-collector