<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
The primary purpose of this PR is to provide greater flexibility in how
OTEL binaries are built, enabling the inclusion of debugging symbols
when needed, without always stripping them by default.
Currently, debugging symbols are only retained when
debug_compilation=true. However, this approach also disables all
compiler inlining and optimizations (gcflags=all=-N -l) to ensure an
exact match between written and executed code, resulting in a
significant increase in CPU consumption. There are scenarios where we
want binaries with debugging symbols and DWARF information while still
allowing the compiler to optimize and inline. This PR addresses that
need by introducing configurable GCFlags.
`ocb --ldflags="" --gcflags="" --config=builder-config.yaml`
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes
[#58](https://github.com/open-telemetry/opentelemetry-collector-releases/issues/58)
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Manual
Override LDflags:

Override both

<!--Describe the documentation added.-->
#### Documentation
README file updated.
--
Backward compatibility concerns:
- As of today, passing cfg.LDFlags will append to LD flags that are by
default to `-s -w`.
Questions:
- Should we deprecate DebugCompilation property?
<!--Please delete paragraphs that you did not use before submitting.-->
This is a no-op, because the file config cannot set the "skip"
properties since they have `mapstructure:"-"`
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Disable strict version check. The `--skip-strict-version-check` is kept
but is now a no-op.
This fixes#11152.
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes#11152
A continuation of
https://github.com/open-telemetry/opentelemetry-collector/pull/9253 and
https://github.com/open-telemetry/opentelemetry-collector/pull/9631
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.
Link to tracking Issue:
https://github.com/open-telemetry/opentelemetry-collector/issues/9252
Testing: Will add unit tests in the next few days.
Documentation: Yes.
---------
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
**Description:** <Describe what has changed.>
Adds strict version checking in the builder. This enables users to
ensure that the versions specified in the builder config are the
versions used in the go.mod when building the collector binary. This can
be disabled with --skip-strict-versioning.
**Link to tracking Issue:** #9896
**Testing:** Added unit tests
**Documentation:** Added to builder README
---------
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
This option makes the builder skip generating sources.
**Link to tracking Issue:** #7541
**Testing:** Unit tests
**Documentation:** as part of the CLI help menu
Signed-off-by: Francois JACQUES <hypnoce@donarproject.org>
* [chore] use license shortform
To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052
Signed-off-by: Alex Boten <aboten@lightstep.com>
* make goporto
Signed-off-by: Alex Boten <aboten@lightstep.com>
---------
Signed-off-by: Alex Boten <aboten@lightstep.com>