add ability to read symlink basedirs - #438
Merged
Merged
Conversation
Member
|
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
- quxI 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. |
Contributor
Author
|
Hey @mattfarina, any updates on this? |
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
added a commit
that referenced
this pull request
Jun 2, 2016
Member
|
@klnusbaum I found the problem, fixed it, and merged into master. Thanks for the contribution. |
Contributor
Author
|
awsome! Thanks @mattfarina ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/myprojectand runglide createto generate their initialglide.yamlfile. The result is the creation of emptyglide.yamlfile. Sad times.What's happening is that the
basedirgiven toNewResolveris actually a symlink. This in turn causes an issue in theResolveLocalfunction. Theif !fi.IsDir()check fails since the basedir isn't actually a directory, it's a symlink.Let's add a check to the
NewResolverfunction. After getting the absolute path of the providedbasedir, 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.