Skip to content

[chore] Migrate to go.mod tool directives#45739

Merged
mx-psi merged 3 commits into
open-telemetry:mainfrom
axw:go-mod-tools
Feb 17, 2026
Merged

[chore] Migrate to go.mod tool directives#45739
mx-psi merged 3 commits into
open-telemetry:mainfrom
axw:go-mod-tools

Conversation

@axw
Copy link
Copy Markdown
Contributor

@axw axw commented Jan 30, 2026

Description

Modernise Go build tool dependency management, switching from the old "tools.go" approach to go.mod tool directives, and removing the need for explicitly installing tools. Tools are now invoked with go tool <package/path>. The tool directive for genqlient has been added directly to githubreceiver, which was the only component using it.

See this core collector PR for reference: open-telemetry/opentelemetry-collector#13906

Link to tracking issue

None

Testing

N/A

Documentation

Updated

@axw axw force-pushed the go-mod-tools branch 2 times, most recently from a07e1d1 to 216542f Compare January 30, 2026 06:02
@axw
Copy link
Copy Markdown
Contributor Author

axw commented Jan 30, 2026

There's some annoying edge cases related to local commands (schemagen, codecovgen) which shouldn't really need a tool entry at all. I'll come back to it next week.

axw added a commit to axw/opentelemetry-collector-contrib that referenced this pull request Jan 31, 2026
Simplify by removing these local tools from tools.go,
instead running them directly with "go run".

This is an offshoot of
open-telemetry#45739
axw added a commit to axw/opentelemetry-collector-contrib that referenced this pull request Jan 31, 2026
Simplify by removing these local tools from tools.go,
instead running them directly with "go run".

This is an offshoot of
open-telemetry#45739
songy23 pushed a commit that referenced this pull request Feb 2, 2026
#### Description

Introduce a `make mdatagen` target, which defaults to invoking the tool
with metadata.yaml in the module directory. The metadata.yaml file path
may be overridden by setting the env var MDATAGEN_METADATA_YAML.

This will simplify moving away from installing tools, and using "go
tool". Offshoot of #45739

#### Link to tracking issue

N/A

#### Testing

N/A

#### Documentation

Updated docs/new-components.md
atoulme pushed a commit that referenced this pull request Feb 4, 2026
#### Description

Simplify by removing these local tools from tools.go, instead running
them directly with "go run".

This is an offshoot of
#45739,
which will remove internal/tools/tools.go and use go.mod tool
directives. For these local tools, it's simpler just to run them
directly.

#### Link to tracking issue

N/A

#### Testing

N/A

#### Documentation

Updated cmd/schemagen/README.md to remove mention of install-tools
approach
@axw axw force-pushed the go-mod-tools branch 3 times, most recently from 1bd1213 to 7124233 Compare February 5, 2026 06:13
@axw
Copy link
Copy Markdown
Contributor Author

axw commented Feb 6, 2026

I've now bumped into golang/go#72824, which is fixed in Go 1.25. Rather than complicating the Makefile, I'll put this on hold until we've updated to Go 1.25, which should be soon (Go 1.26 is due to be released in February 2026.)

@axw axw force-pushed the go-mod-tools branch 3 times, most recently from 0e0065e to 8c8aa0b Compare February 13, 2026 00:49
Copy link
Copy Markdown
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though I am scared that we will accidentally break something when doing this and it will be hard to notice. Is there any way to mitigate that?

@axw
Copy link
Copy Markdown
Contributor Author

axw commented Feb 17, 2026

I am scared that we will accidentally break something when doing this and it will be hard to notice. Is there any way to mitigate that?

@mx-psi is there a specific concern you have? Otherwise I don't know how to answer, other than to do nothing. We can and should quickly revert it if it breaks something.

Given that the change is to move from running a command in $PATH to running go tool <...>, I would expect it to be easier to spot issues than before.

@mx-psi
Copy link
Copy Markdown
Member

mx-psi commented Feb 17, 2026

I am scared that we will accidentally break something when doing this and it will be hard to notice. Is there any way to mitigate that?

@mx-psi is there a specific concern you have? Otherwise I don't know how to answer, other than to do nothing. We can and should quickly revert it if it breaks something.

We have had issues in the past where a subset of tests were not running and it was hard to identify (see #30901 and #32518), I want to avoid that.

I don't have a good solution for avoiding these kinds of issues and the code looks reasonable to me, so I am just going to merge this and we can keep an extra eye on this.

@mx-psi mx-psi merged commit 1c38b66 into open-telemetry:main Feb 17, 2026
198 checks passed
evan-bradley added a commit that referenced this pull request Feb 17, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Follow up from
#45739
to use Make to invoke githubgen.

I tried to clean things up a bit, but wasn't sure what should be used
when and what makes sense to change. I've opened an issue to track this
in case anyone would like to go deeper:
#46150.
geekdave pushed a commit to oso-team/opentelemetry-collector-contrib that referenced this pull request Feb 20, 2026
#### Description

Modernise Go build tool dependency management, switching from the old
"tools.go" approach to go.mod tool directives, and removing the need for
explicitly installing tools. Tools are now invoked with `go tool
<package/path>`. The tool directive for `genqlient` has been added
directly to githubreceiver, which was the only component using it.

See this core collector PR for reference:
open-telemetry/opentelemetry-collector#13906

#### Link to tracking issue

None

#### Testing

N/A

#### Documentation

Updated
geekdave pushed a commit to oso-team/opentelemetry-collector-contrib that referenced this pull request Feb 20, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Follow up from
open-telemetry#45739
to use Make to invoke githubgen.

I tried to clean things up a bit, but wasn't sure what should be used
when and what makes sense to change. I've opened an issue to track this
in case anyone would like to go deeper:
open-telemetry#46150.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants