#### Description
[gofumpt](https://golangci-lint.run/usage/linters/#gofumpt) is a
stricter format than gofmt, while being backwards compatible.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
```
debug.ReadBuildInfo()
```
returns an error for some environments, which then panics on
`info.Main.Version`:
```
panic: runtime error: invalid memory address or nil pointer dereference
```
this fixes the issue by only updating the version if
`debug.ReadBuildInfo()` succeeds
Revert "[chore] delete code to set a version and date, as it it not used
(#10715)"
Remove date string but re-add functions that check for version number
This (mostly) reverts commit b53f57d.
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This re-enables the functionality to set a version number for ocb binary
(cmd/builder). It was erroneously removed. It also adds unit tests for
this functionality, as a warning is given on CI with no code coverage.
<!-- Issue number if applicable -->
#### Link to tracking issue
Relates to
https://github.com/open-telemetry/opentelemetry-collector-releases/issues/664.
Closes#11220 along with
https://github.com/open-telemetry/opentelemetry-collector-releases/pull/665
<!--Describe what testing was performed and which tests were added.-->
#### Testing
ran build and release cycles inside personal fork repositories
(jackgopack4/opentelemetry-collector and
jackgopack4/opentelemetry-collector-releases)
<!--Describe the documentation added.-->
#### Documentation
.chloggen file
<!--Please delete paragraphs that you did not use before submitting.-->
With this change, running `builder version` on binaries installed with
`go install` will output the version specified at the suffix.
If it's under development, the following output will be obtained.
```
$ GO111MODULE=on CGO_ENABLED=0 go run . version
ocb version (devel)
```
**Link to tracking Issue:** #8770
---------
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
* [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>
Update the builder to consistently use "ocb" in the name of the command,
version. Since the builder does not expand environment variables in the
config file pathname, the default value for `--config` does not work,
so we can make this flag required so that users don't silently build an
inoperative collector.
This fixes#5581.
Signed-off-by: James Peach <jpeach@cloudflare.com>