Closed callpraths closed 6 years ago
There are two distinct problems here: First is minor: The README already talks about go tooling's problems with relative paths with --full-isolation. This is another instance of that.
$ go build hello
works under some conditions.
The second problem is that to get to the good case above, I had to clear the env before 'vg init' I did:
vg destroy
rm .virtualgo
sudo -u callpraths bash
vg init
go build hello
# works
Looks like we're leaking some env variables from earlier vg invocations in a way that when we run vg init
later, we do not call ws.InstallLocalPackagePersistently in initSettings.go because GOPATH is found to not be a prefix of cwd.
Thanks for the bug report. I'll add the internal package problem to the README in the section with the problems that using absolute paths fixes.
For your second problem I'm a bit confused about how you got in the broken state, but it indeed sounds like a bug. Could you make a separate issue for that problem with full steps for reproducing it? Because it seems quite unrelated to the internal packages problem.
Just updated the README with this issue.
I'm gonna close this, since I updated the README. Please open a new issue for the second problem you ran into.
Here's a simplified example: (hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ tree
(hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ cat internal/hello2/hello2.go package hello2
(hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ vim hello.go (hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ cat hello.go
Without vg: callpraths@remote-workstation:/mnt/work/go/src/hello$ go run hello.go hello2
With vg (but fallback to GOPATH): callpraths@remote-workstation:/mnt/work/go/src/hello$ vg init Creating workspace "hello" with global fallback import mode Activating hello Linking /mnt/work/go/src/hello to workspace 'hello' (hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ go run hello.go hello2
With vg (full isolation): (hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ vg destroy Destroying workspace "hello" Deactivating hello callpraths@remote-workstation:/mnt/work/go/src/hello$ vg init --full-isolation Creating workspace "hello" with full isolation import mode Installing local sources at "/mnt/work/go/src/hello" in workspace as "hello" using bindfs Persisting the local install for "hello" Activating hello Uninstalling "hello" from workspace Unmounting bindfs mount at "/home/callpraths/.virtualgo/hello/src/hello" Removing sources at "/home/callpraths/.virtualgo/hello/src/hello" Installing local sources at "/mnt/work/go/src/hello" in workspace as "hello" using bindfs Persisting the local install for "hello" Linking /mnt/work/go/src/hello to workspace 'hello' (hello) callpraths@remote-workstation:/mnt/work/go/src/hello$ go run hello.go hello.go:4:2: use of internal package not allowed