GetStream / vg

Virtualgo: Easy and powerful workspace based development for go
MIT License
1.32k stars 45 forks source link

'vg ensure' fails when project directory and home directory are located on different devices #44

Open amarthadan opened 6 years ago

amarthadan commented 6 years ago

Command vg ensure run within the project directory and activated workspace returns:

(project) [user@machine project][✔]$ vg ensure
Running "dep ensure"
Error: Couldn't move the vendor directory to the active workspace: rename vendor /home/user/.virtualgo/project/src: invalid cross-device link
Usage:
  vg ensure [-- [arguments to dep ensure]] [flags]

Flags:
  -h, --help   help for ensure

Couldn't move the vendor directory to the active workspace: rename vendor /home/uservirtualgo/project/src: invalid cross-device link

This is caused by the fact that my home directory is located on one device (/dev/sdb3) and my project directory on another (/dev/sda1). Call to os.Rename (https://github.com/GetStream/vg/blob/master/cmd/ensure.go#L143) will return a LinkError.

JelteF commented 6 years ago

Hmm, it should probably fallback to copying and removing in that case. As a workaround for now you can use the current vg master. Then you can set the VIRTUALGO_ROOT variable to something on the same device as your project. That should make it work.

lpbearden commented 5 years ago

I'm a bit confused by this workaround. When would you set the VIRTUALGO_ROOT? I'm trying to get this working with a home directory in the Windows filesystem and the project directory on WSL.

JelteF commented 5 years ago

The problem is that vg runs the go version of mv $yourgoproject/vendor $VIRTUALGO_ROOT/$VIRTUALGO/src. But mv fails when the source and target are not on the same filesystem. So to workaround make sure that your project and $VIRTUALGO_ROOT are on the same filesystem.