Skip to content

go install fails for mdatagen #9281

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

Open
atoulme opened this issue Jan 12, 2024 · 16 comments · Fixed by #9310
Open

go install fails for mdatagen #9281

atoulme opened this issue Jan 12, 2024 · 16 comments · Fixed by #9310

Comments

@atoulme
Copy link
Contributor

atoulme commented Jan 12, 2024

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.
@bogdandrutu
Copy link
Member

@atoulme
Copy link
Contributor Author

atoulme commented Jan 23, 2024

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.

@cpheps
Copy link
Contributor

cpheps commented Mar 29, 2024

We are also experiencing this when trying to install the mdatagen tool via go install for our distribution.

@khushhboo
Copy link

Is there a fix for this yet? Trying to update some generated files in vcenterreceiver.

@atoulme
Copy link
Contributor Author

atoulme commented Mar 31, 2024

Weird, please make sure you are on latest main and run make generate.

@khushhboo
Copy link

khushhboo commented Apr 1, 2024

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.

@atoulme
Copy link
Contributor Author

atoulme commented Apr 11, 2024

Please check that GOBIN is in your PATH. This might be the problem.

@woody1872
Copy link

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.

@atoulme
Copy link
Contributor Author

atoulme commented May 2, 2024

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

@mmynk
Copy link

mmynk commented May 6, 2024

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?

@TamerSherif
Copy link

still experiencing this when doing go install go.opentelemetry.io/collector/cmd/[email protected]

@fredyfredburger
Copy link

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.

@mmynk
Copy link

mmynk commented Aug 8, 2024

Why was this closed?

@fredyfredburger It's not closed.

@fredyfredburger
Copy link

Derp; I saw "open-telemetry/opentelemetry-collector-contrib#33603 Closed" and thought this ticket was closed. That's my bad!

@fredyfredburger
Copy link

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

@VenuEmmadi
Copy link
Member

$ go install go.opentelemetry.io/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.

Still issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants