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

add ability to read symlink basedirs #438

Merged
merged 1 commit into from
Jun 2, 2016

Conversation

klnusbaum
Copy link
Contributor

@klnusbaum klnusbaum commented May 22, 2016

Imagine the following scenario: A user has a Go project. This directory is sitting in an arbitrary location in their file system and the user would like to keep it there. However, they need it to work with Go tooling, so they symlink it into an appropriate location in their GOPATH, e.g. $GOPATH/src/github.com/user1/myproject. The user then decides they's like to start using glide, so they cd to $GOPATH/src/github.com/user1/myproject and run glide create to generate their initial glide.yaml file. The result is the creation of empty glide.yaml file. Sad times.

What's happening is that the basedir given to NewResolver is actually a symlink. This in turn causes an issue in the ResolveLocal function. The if !fi.IsDir() check fails since the basedir isn't actually a directory, it's a symlink.

Let's add a check to the NewResolver function. After getting the absolute path of the provided basedir, let's check to see if it's a symlink. If it is, read the symlink and use that as the basedir instead. If not, proceed as normal.

@mattfarina
Copy link
Member

mattfarina commented May 23, 2016

I really like this change.

Unfortunately, I case where project can be added to itself. For example,

package: github.com/foo/bar
import:
- package: github.com/foo/bar
  subpackages:
  - baz
  - qux

I discovered this on a private project so I can't share.

Once we get this fixed I'll be happy to merge this. I'll try to dig into it more later this week. If you find the solution before then that would be great, too.

Note, updated to fix formatting.

@mattfarina mattfarina added this to the 0.11 milestone May 23, 2016
@klnusbaum
Copy link
Contributor Author

Hey @mattfarina, any updates on this?

@mattfarina
Copy link
Member

@klnusbaum I've been traveling and then had a holiday weekend so I got a little behind. Need to figure out that bug so we can merge this.

@mattfarina mattfarina merged commit 52f7192 into Masterminds:master Jun 2, 2016
@mattfarina
Copy link
Member

@klnusbaum I found the problem, fixed it, and merged into master. Thanks for the contribution.

@klnusbaum
Copy link
Contributor Author

awsome! Thanks @mattfarina !

@klnusbaum klnusbaum deleted the check_basedir_symlink branch June 6, 2016 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants