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
x/vgo: Is it possible to vgo install a custom library outside of GOPATH? #25639
Comments
/cc @myitcv , @kardianos - Not sure if this is to be interpreted as a question or an issue. |
@TerrenceHo - is there a reason you need to If you are writing code outside of |
@myitcv No, I just thought that writing a package outside of GOPATH would install into the correct directory in the GOPATH pkg tree based on the import module name, due to rsc's statement that vgo would deprecate GOPATH. I was just experimenting with vgo. So in the future, we should continue to write libraries inside the GOPATH/src tree? @agnivade This is more of a question than an issue, although if vgo should support installing a non main package from outside GOPATH, then it could be considered an issue. |
As I understand things, GOPATH is no longer a requirement; I'm not entirely clear that it will disappear entirely though. So, as per the vgo examples, you don't need to develop within GOPATH, but you can (for now). If you are developing outside GOPATH, then If you are developing inside GOPATH, the Tools like |
I believe Paul's answer clarifies things as working as intended. Hence closing this. Feel free to comment if you disagree. |
Perhaps I missed this in rsc's vgo introduction, but how is vgo install supposed to work when you install a custom package outside of the GOPATH?
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64
go version go1.10 darwin/amd64 vgo:2018-02-20.1
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
I recreated the
stringutil
package from the "How to Write Go Code" in a directory outside of the GOPATH, but added import statements. Thestringutil2
is located in~/Desktop/stringutil2
. File is below.I added an empty go.mod file. I then attempted a vgo build in this directory. The go.mod file has the module name correctly added.
Now that it builds correctly, I attempt to use vgo and install it, still attempting to follow the tutorial.
What did you expect to see?
I expected this package to be installed under
$GOPATH/pkg/darwin_amd64/github.com/TerrenceHo/stringutil2.a
What did you see instead?
It errors out, saying it cannot locate the
GOPATH
. The vgo proposal mentioned being able to write Go code anywhere, not just within theGOPATH
. As such, I thought this would succeed, since I had implemented the correct go.mod file. Additionally, if you try installing a main package, i.e. an executable,vgo install
succeeds.The text was updated successfully, but these errors were encountered: