opentelemetry-collector
opentelemetry-collector copied to clipboard
`go install` fails for `mdatagen`
Expected:
cd /tmp
go install github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest
should install mdatagen under $GOBIN.
Actual:
go install github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest
go: github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest (in github.com/open-telemetry/opentelemetry-collector/cmd/[email protected]):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
Not sure if this is a real problem, because this seem to work in CI, see https://github.com/open-telemetry/opentelemetry-collector/blob/main/.github/workflows/build-and-test.yml#L120 and https://github.com/open-telemetry/opentelemetry-collector/blob/main/Makefile#L81
It works in this repository, but not under a different folder. This means we can't use it for contrib. I have amended the steps to reproduce.
We are also experiencing this when trying to install the mdatagen tool via go install for our distribution.
Is there a fix for this yet? Trying to update some generated files in vcenterreceiver.
Weird, please make sure you are on latest main and run make generate.
Issue persists, tried from inside a folder and from repository as well. Make generate fails.
Error displayed after go install github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest: go: go.opentelemetry.io/collector/cmd/mdatagen@latest (in go.opentelemetry.io/collector/cmd/[email protected]): The go.mod file for the module providing named packages contains one or more replace directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module.
Please check that GOBIN is in your PATH. This might be the problem.
Also seeing this issue:
$ go install github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest
go: github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latest (in github.com/open-telemetry/opentelemetry-collector/cmd/[email protected]):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
I also can still reproduce. The way contrib works around this is by importing mdatagen into a go.mod first, and then install from there: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/Makefile#L283
Some traction on this would be appreciated.
Trying to understand why the replace directives were added in the first place in #9358. What issue does that solve?
still experiencing this when doing go install go.opentelemetry.io/collector/cmd/[email protected]
Why was this closed? This is still an issue. Currently have to manually build mdatagen to get this to work.
go install go.opentelemetry.io/collector/cmd/mdatagen@latest
go: downloading go.opentelemetry.io/collector/cmd/mdatagen v0.106.1 go: go.opentelemetry.io/collector/cmd/mdatagen@latest (in go.opentelemetry.io/collector/cmd/[email protected]): The go.mod file for the module providing named packages contains one or more replace directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module.
Why was this closed?
@fredyfredburger It's not closed.
Derp; I saw "https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33603 Closed" and thought this ticket was closed. That's my bad!
Since I did the dumb and commented something useless on this ticket, I'll try to redeem myself by adding a temporary solution for those finding this ticket like I did looking for an answer:
git clone https://github.com/open-telemetry/opentelemetry-collector.git
cd opentelemetry-collector/cmd/mdatagen
sed -i '/replace/d' go.mod
go install