Dep: Symlinked project root is not handled as I would expect from FAQ

Created on 10 Sep 2017  路  3Comments  路  Source: golang/dep

What version of dep are you using (dep version)?

v0.3.0-273-g16990a1

What dep command did you run?

[aat@cavern:~/Projects]echo $GOPATH
/Users/aat/go
[aat@cavern:~/Projects]ln -s $GOPATH/src/github.com/alecthomas/gometalinter ~/Projects/gometalinter
[aat@cavern:~/Projects]ls -l gometalinter
lrwxr-x---  1 aat  staff  52 10 Sep 12:12 gometalinter@ -> /Users/aat/go/src/github.com/alecthomas/gometalinter
[aat@cavern:~/Projects]cd gometalinter
[aat@cavern:~/Projects/gometalinter]dep init
root project import: /Users/aat/Projects/gometalinter not in GOPATH

What did you expect to see?

According to the FAQ I would expect this to work:

If the symlink is outside GOPATH and links to a directory within a GOPATH, or vice versa, then dep will choose whichever path is within GOPATH.

The ln example in that FAQ entry is effectively what I did, and assumed would work.

What did you see instead?

The above error.

Most helpful comment

This is getting me too. My set up is this:

In side my GOPATH, my src directory is symlinked elsewhere. I like all my dev projects (go and otherwise) in one place, and I didn't want that one place to be go-specific, so this is the setup I've had for years.

And here's what happens:

$ dep status      
/Users/karlie/Workspace/github.com/myorg/myproject is not within a known GOPATH/src
$ echo $GOPATH
/Users/karlie/go
$ ll /Users/karlie/go
total 8
drwxr-xr-x  51 karlie  staff   1.7K Jul 24  2017 bin
drwxr-xr-x   3 karlie  staff   102B Feb  6  2015 pkg
lrwxr-xr-x   1 karlie  staff    23B Feb  6  2015 src -> /Users/karlie/Workspace

I'm really excited about using dep, but I really don't like that I'd need to reorganize my workspace.

Seems like there've been PRs up for a while that might address this issue. Is there any urgency? Or should I bite the bullet and spend the time reorganizing my workspace (really don't want)?

All 3 comments

As I would expect, running dep init in $GOPATH/src/github.com/alecthomas/gometalinter works.

hi, welcome! and yeah...sorry.

if you look over the open PRs, you'll see that there are a couple outstanding ones, for more than a month now, which deal with symlinks and project roots. honestly, i've been avoiding dealing with them because there's a lot of other things going on, and every time i have to descend into symlink hell, i can feel my humanity dying.

i'm at least vaguely hopeful that those PRs will get us to the state that's described in the README -
that, prior to those PRs and their related issues, were the state we did think we were in. really. we even have (non-integration) tests for key pieces of the logic. but, because these symlink behaviors tend to be "nice to haves", and because i'm only like 31.4% a masochist, they've been rotting 馃槶

This is getting me too. My set up is this:

In side my GOPATH, my src directory is symlinked elsewhere. I like all my dev projects (go and otherwise) in one place, and I didn't want that one place to be go-specific, so this is the setup I've had for years.

And here's what happens:

$ dep status      
/Users/karlie/Workspace/github.com/myorg/myproject is not within a known GOPATH/src
$ echo $GOPATH
/Users/karlie/go
$ ll /Users/karlie/go
total 8
drwxr-xr-x  51 karlie  staff   1.7K Jul 24  2017 bin
drwxr-xr-x   3 karlie  staff   102B Feb  6  2015 pkg
lrwxr-xr-x   1 karlie  staff    23B Feb  6  2015 src -> /Users/karlie/Workspace

I'm really excited about using dep, but I really don't like that I'd need to reorganize my workspace.

Seems like there've been PRs up for a while that might address this issue. Is there any urgency? Or should I bite the bullet and spend the time reorganizing my workspace (really don't want)?

Was this page helpful?
0 / 5 - 0 ratings