Skip to content
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

Relative paths passed to localInstall work unexpectedly #34

Open
matthijskooijman opened this issue Jan 9, 2018 · 2 comments
Open

Relative paths passed to localInstall work unexpectedly #34

matthijskooijman opened this issue Jan 9, 2018 · 2 comments
Labels

Comments

@matthijskooijman
Copy link

I'm a bit stubborn when it comes to go and directory organisation, so I tried to use vg to create a git clone of my project in whatever directory I wanted (without having to have it in src/github.com/foo/bar). I was hoping that that would take care of creating a virtual GOPATH somewhere, and automatically link my project directory into there in an appropriate place. Unfortunately that did not happen, so I needed a manual vg localInstall to get my project directory linked (which makes sense, since vg does not know the full package name of my project).

So, I tried:

/path/to/bar$ vg localInstall github.com/foo/bar .
/path/to/bar$ mount|grep bar
/path/to/bar on /home/matthijs/.virtualgo/bar/src/github.com/foo/bar type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,default_permissions)

Which indeed correctly puts /path/to/bar in the virtual $GOPATH/src/github.com/foo/bar. However, in virtualgo.toml it stores the original relative path ., and it seems this path is interpreted relative to the current directory, not the project root. E.g. if I deactivate the workspace and then jump into a subdirectory of my project, things get broken:

/$ cd /path/to/bar/sub/
Activating bar
Uninstalling "github.com/foo/bar" from workspace
Unmounting bindfs mount at "/home/matthijs/.virtualgo/bar/src/github.com/foo/bar"
Removing sources at "/home/matthijs/.virtualgo/bar/src/github.com/foo/bar"
Removing "github.com/foo/bar" from locally installed packages
Installing local sources at "." in workspace as "github.com/foo/bar" using bindfs
(bar) matthijs@grubby:/path/to/bar/sub$ mount|grep bar
/path/to/bar/sub on /home/matthijs/.virtualgo/bar/src/github.com/foo/bar type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,default_permissions)

Should the path passed to localInstall be made absolute before storing it?

@JelteF
Copy link
Contributor

JelteF commented Jan 9, 2018

I think it indeed makes sense to make the path absolute before storing. If you want to take a stab at it let me know, otherwise I think I'll fix it in a couple of days.

@matthijskooijman
Copy link
Author

Thanks! No spare time, so I'll leave this one for you :-)

@JelteF JelteF added the bug label Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants