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

go: -mod may only be set to readonly or vendor when in workspace mode, but it is set to "mod" #405

Closed
yangyile1990 opened this issue Mar 4, 2024 · 2 comments

Comments

@yangyile1990
Copy link

yangyile1990 commented Mar 4, 2024

my problem is:

go: -mod may only be set to readonly or vendor when in workspace mode, but it is set to "mod"
Remove the -mod flag to use the default readonly value,
or set GOWORK=off to disable workspace mode.

what is wrong?

//go:generate go run -mod=mod github.com/google/wire/cmd/wire

can not work.

edit the code to this:

//go:generate go run github.com/google/wire/cmd/wire

can work.

while after work the code is replace back to:

//go:generate go run -mod=mod github.com/google/wire/cmd/wire

then can not work.

I have to edit the code again.

may be there is some thing wrong here:

	buf.WriteString("// Code generated by Wire. DO NOT EDIT.\n\n")
	buf.WriteString("//go:generate go run -mod=mod github.com/google/wire/cmd/wire" + tags + "\n")
	buf.WriteString("//+build !wireinject\n\n")
	buf.WriteString("package ")
	buf.WriteString(g.pkg.Name)
	buf.WriteString("\n\n")

it always generete code:

//go:generate go run -mod=mod github.com/google/wire/cmd/wire

or may be there is some other wrong.

but I don't know how to fix it.

@CoreFloDev
Copy link

that's a duplicate of #403

@yangyile1990
Copy link
Author

that's a duplicate of #403

OK let me close this issue. and wait for you solve that problem.

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

No branches or pull requests

2 participants