Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upx/vgo: cannot determine module path for source directory ... (outside GOPATH, no import comments) #25176
Comments
gopherbot
added this to the vgo milestone
Apr 30, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ALTree
Apr 30, 2018
Member
Does adding a line like:
module "bitbucket.org/saeedgnu/test"
at the top of the go.mod file fix this?
|
Does adding a line like:
at the top of the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ilius
Apr 30, 2018
@ALTree Yes that would fix the problem. Is this an expected behavior?
In some other repos this step was not needed. It's not mentioned in https://research.swtch.com/vgo-tour
Is there a more up to date documentation?
ilius
commented
Apr 30, 2018
•
|
@ALTree Yes that would fix the problem. Is this an expected behavior? In some other repos this step was not needed. It's not mentioned in https://research.swtch.com/vgo-tour |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ALTree
Apr 30, 2018
Member
It's not mentioned in https://research.swtch.com/vgo-tour
The tour is meant to give an overview of how you'll use vgo, and I don't think the goal was to exhaustively document how vgo works. It explicitly says to create a folder outside gopath, and if you deviate from the given path your "tour experience" wont' be as smooth. Keep in mind that vgo will likely effectively deprecate GOPATH... so you're not supposed to create your vgo modules there.
The tour is meant to give an overview of how you'll use vgo, and I don't think the goal was to exhaustively document how vgo works. It explicitly says to create a folder outside gopath, and if you deviate from the given path your "tour experience" wont' be as smooth. Keep in mind that |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ilius
Apr 30, 2018
What do you mean deprecate GOPATH?
I don't think most companies would be willing to move their Go projects into outside of GOPATH.
Since they usually use the Team Name as the owner/parent of our git repos, so all the packages (main and non-main) are sub-directories of a single directory associated to that team (if they are not in a single repo) inside GOPATH.
Also some main packages main contain sub-packages that are imported by another main package, so they all need to be inside GOPATH.
Your approach is only possible in a Mono Repo design, that overrides GOPATH inside that repo.
ilius
commented
Apr 30, 2018
•
|
What do you mean deprecate GOPATH? Your approach is only possible in a Mono Repo design, that overrides GOPATH inside that repo. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ALTree
Apr 30, 2018
Member
Ensuring a smooth transition from the current status is one of the top priorities for the vgo proposal.
Anyway we don't use the issue tracker for general discussion or asking questions about the language. The Github bug tracker is only used to track Go bugs.
Please see the Questions wiki page; it has a list of good places for asking questions.
|
Ensuring a smooth transition from the current status is one of the top priorities for the Anyway we don't use the issue tracker for general discussion or asking questions about the language. The Github bug tracker is only used to track Go bugs. Please see the Questions wiki page; it has a list of good places for asking questions. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kardianos
May 1, 2018
Contributor
Your GOPATH is probably not explicitly set. Maybe this code doesn't yet use default GOPATH when adding module path. Make sure you have updated vgo to latest.
|
Your GOPATH is probably not explicitly set. Maybe this code doesn't yet use default GOPATH when adding module path. Make sure you have updated vgo to latest. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ilius
May 2, 2018
@kardianos My GOPATH is set in ~/.bashrc, and echo $GOPATH in my test repo shows it.
And I'm using the latest (with go get -u golang.org/x/vgo)
Looks like I only have this problem in repos in "bitbucket.org" directory, but not "github.com".
Oh, and there is no .envrc in my test repo.
ilius
commented
May 2, 2018
|
@kardianos My GOPATH is set in |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gopherbot
May 3, 2018
Change https://golang.org/cl/111264 mentions this issue: cmd/go/internal/vgo: do not shadow GOPATH dir var
gopherbot
commented
May 3, 2018
|
Change https://golang.org/cl/111264 mentions this issue: |
This was referenced May 8, 2018
gopherbot
closed this
in
golang/vgo@b39cea3
May 15, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ilius
commented
May 15, 2018
|
I can confirm that the bug is fixed. Thank you :) |
ilius commentedApr 30, 2018
•
edited
What version of Go are you using (
go version)?go version go1.10.1 linux/amd64Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?What did you do?
My GOPATH is
/home/go, and my user has full access to it.I created a directory named "test" in /home/go/src/bitbucket.org/saeedgnu/
Then cd to /home/go/src/bitbucket.org/saeedgnu/test/
And created a minimal "main.go" file in current directory:
Then created an empty file "go.mod" in current directory (
touch go.mod)And ran
vgo buildWhat did you expect to see?
The package to be compiled (a binary file named "test" created in current directory)
What did you see instead?
I got this error:
Note: Adding the import comment will fix the problem:
But the bug is in the outside GOPATH part of error, while the current directory in inside GOPATH.