You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wire ./... seems to work fine, but go generate ./... now fails due to the use of go run with -mod=mod
go version
go version go1.22.0 darwin/arm64
grep wire go.mod
github.com/google/wire v0.6.0
To Reproduce
Create a wired module and try to run generate to re-wire it.
go generate ./...
# ...
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.
Expected behavior
go generate should work just as well as wire - the generated //go:generate line should not be so different that it cannot run.
Version
0.6.0
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Have the same issue for go version go1.21.6 darwin/arm64 and the latest wire v0.6.0
My project uses go workspaces (there is go.work file in the root). This is the main reason for the issue, probably.
It is fixable by removing "-mod=mod" from the generated wire_gen.go file. But it returns after the next code generation.
One solution that would work for me:
When the wire gen -header_file flag is specified, do not output the first 3 lines in a generated file ("DO NOT EDIT" comment, new line, go-generate command).
Describe the bug
wire ./...
seems to work fine, butgo generate ./...
now fails due to the use of go run with -mod=modTo Reproduce
Create a wired module and try to run generate to re-wire it.
Expected behavior
go generate should work just as well as wire - the generated
//go:generate
line should not be so different that it cannot run.Version
0.6.0
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: