Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmd/builder] ocb fails on some environments due to go.mod issue #11844

Open
jackgopack4 opened this issue Dec 10, 2024 · 2 comments · May be fixed by #11845
Open

[cmd/builder] ocb fails on some environments due to go.mod issue #11844

jackgopack4 opened this issue Dec 10, 2024 · 2 comments · May be fixed by #11845
Labels
area:builder enhancement New feature or request

Comments

@jackgopack4
Copy link
Contributor

Describe the bug
ocb fails to build collector-contrib in Github workspace due to failing to download go 1.22 (not a specific distro/version)

Steps to reproduce

open collector-contrib on github workspace and run make e2e test

opentelemetry-collector-contrib git:(main) make e2e-test

/home/bits/go/src/github.com/DataDog/opentelemetry-collector-contrib/.tools/builder --skip-compilation --config cmd/otelcontribcol/builder-config.yaml --output-path cmd/otelcontribcol
Flag --output-path has been deprecated, use config distribution::output_path
2024-12-10T21:14:11.753Z	INFO	internal/command.go:97	OpenTelemetry Collector Builder	{"version": "v0.115.1-0.20241206185113-3f3e208e71b8"}
2024-12-10T21:14:11.753Z	INFO	internal/command.go:102	Using config file	{"path": "cmd/otelcontribcol/builder-config.yaml"}
2024-12-10T21:14:11.758Z	INFO	builder/config.go:162	Using go	{"go-executable": "/usr/local/go/bin/go"}
2024-12-10T21:14:11.766Z	INFO	builder/main.go:99	Sources created	{"path": "cmd/otelcontribcol"}
Error: failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.22]': exit status 1, error message: go: downloading go1.22 (linux/amd64)
go: download go1.22 for linux/amd64: toolchain not available

make: *** [Makefile:347: genotelcontribcol] Error 1

What did you expect to see?
e2e test runs sucessfully

What did you see instead?
see error message above

What version did you use?

What config did you use?

Environment
Github workspace

Additional context
as @ankitpatel96 pointed out to me, it seems that from Go 1.21 and onward, there needs to be a sub-version specified in go.mod files. golang/go#62278
Also, all the other go.mod files in collector repo have a 1.22.0 specification, so this seems like an easy, uncontroversial fix.

@jackgopack4 jackgopack4 added the bug Something isn't working label Dec 10, 2024
@mx-psi
Copy link
Member

mx-psi commented Dec 11, 2024

it seems that from Go 1.21 and onward, there needs to be a sub-version specified in go.mod files. golang/go#62278

There is no requirement for this, as you can see, for example, on the stdlib go.mod. Modules are free to use the 'language version' go 1.22 which has a different ordering from go 1.22.0 when it comes to beta versions (see here). I think this comment summarizes the (confusing) situation well: golang/go#62278 (comment).

Error: failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.22]': exit status 1, error message: go: downloading go1.22 (linux/amd64)
go: download go1.22 for linux/amd64: toolchain not available

You need golang/go@27ed85d, which is available in Go 1.23, Go 1.22 starting from Go 1.22.4 or Go 1.21 starting from Go 1.21.11

@jackgopack4
Copy link
Contributor Author

jackgopack4 commented Dec 11, 2024

thanks for the update; glad Golang has fixed this issue. It still might be worth allowing ocb to set a "toolchain" version based on the current go environment; I'll play around a little more with that.

@mx-psi mx-psi added enhancement New feature or request and removed bug Something isn't working waiting-for-author labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:builder enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants