This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
ensure-add/avoid panic when adding current project as its own dependency #1147
Merged
Conversation
This file contains 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
Close/open to trigger Appveyor |
sdboyer
approved these changes
Sep 10, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jmank88
reviewed
Sep 11, 2017
cmd/dep/ensure.go
Outdated
@@ -500,6 +500,11 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm | |||
return err | |||
} | |||
|
|||
// check if the the parsed path is the current root path | |||
if p.ImportRoot == pc.Ident.ProjectRoot { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdboyer We don't need strings.EqualFold
or similar here, do we?
hmm, probably yes, as of #1079. but no need to wait on doing it
here,now, as this is pretty isolated.
…On 09/11 12:33, Jordan Krage wrote:
jmank88 commented on this pull request.
> @@ -500,6 +500,11 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
return err
}
+ // check if the the parsed path is the current root path
+ if p.ImportRoot == pc.Ident.ProjectRoot {
@sdboyer We don't need `strings.EqualFold` or similar here, do we?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#1147 (review)
|
sdboyer
suggested changes
Sep 12, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make that strings.EqualFold()
change, then this is ready to merge!
jmank88
approved these changes
Sep 12, 2017
sdboyer
approved these changes
Sep 12, 2017
ibrasho
approved these changes
Sep 12, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
zknill
pushed a commit
to zknill/dep
that referenced
this pull request
Oct 6, 2017
…ncy (golang#1147) * add failing test for self add * check if the import project is current project and bail out * add init test case * use strings.EqualFold for path check
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What does this do / why do we need it?
This PR will return an error instead of panicking when current project is being added to its own dependency
What should your reviewer look out for in this PR?
This is a simple check that ensures the current project is not added as its own dependency and bail out early
Do you need help or clarification on anything?
For harness tests, I have thought of two scenarios
Which issue(s) does this PR fix?
fixes #1123