-
Notifications
You must be signed in to change notification settings - Fork 257
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
Support for go modules #124
Comments
Someone else saw this same error... I'll have to look into it. I think it may not be modules. It may be the fact that mage uses a customized version of go/build. |
golang.org/x/tools/go/packages will support Go 1.10 as well, probably not Go 1.9. |
I just tried the latest version of mage and reproduced the problem. It looks like it really is modules. But I have a fix for go/build for Go 1.11 that should make mage and many other programs keep working. |
Thank you @rsc, I really appreciate it. |
This is fixed by #131 |
Beginning in go 1.11 go will have opt-in support for the vgo module system proposed by Russ Cox.
We've started testing support for this using Go
tip
and have run into an issue with mage.We have a library that we use with our common mage operations. It is tagged and has a version greater than 1. As a result, its
go.mod
file lists the module as something likemodule github.com/foo/bar/v2
. This means that imports of this module in the magefile would useimport bar "github.com/foo/bar/v2"
even though the module is downloaded (and would have been placed in the $GOPATH) atgithub.com/foo/bar
.The error we get when trying to compile the magefile is something like:
This stems from the fact that the stdlib
go/*
packages do not (and may never: golang/go#26433) support modules. The recommendation was to, instead, use the still in development golang.org/x/tools/go/packages package (which will only support Go 1.11 and later).Until this issue is resolved, mage can't work seamlessly with go modules at all. Either we import with
github.com/foo/bar
in the magefile and vgo will use the latest v1 release (which is the wrong version), or we importgithub.com/foo/bar/v2
in the magefile and mage fails to build the magefile at all.The text was updated successfully, but these errors were encountered: