Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

dep init - support relative path #571

Merged
merged 3 commits into from
May 21, 2017
Merged

dep init - support relative path #571

merged 3 commits into from
May 21, 2017

Conversation

niranjan92
Copy link
Contributor

Fixes #537

Need some help on test cases. The current approach is giving issues as adding tests to harness_tests/init cannot find vendor paths. Let me know if there is a better approach to test this feature.

@sdboyer
Copy link
Member

sdboyer commented May 13, 2017

My plan is this - create a test folder in /tmp, copying the code and running dep init and testing if the vendor path and .toml and .lock files are generated correctly.

This sounds fine. I'd also use figuring this out as a reason to look at some of the other tests to see how they accomplish this goal. You'd also likely be able to reuse some of the testing harness internals to facilitate this, even though doing a standard case on disk doesn't work.

@niranjan92
Copy link
Contributor Author

niranjan92 commented May 13, 2017

@sdboyer : i have added the test for checking relative path without touching the existing tests. The tests check if dep init ran correctly and created the .toml and .lock files correctly.

if !filepath.IsAbs(args[0]) {
root = filepath.Join(ctx.WorkingDir, args[0])
}
if err := os.MkdirAll(root, os.FileMode(0777)); err != nil {
Copy link
Collaborator

@ibrasho ibrasho May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the default 777? Wouldn't 755 be enough for most cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had made it 755 in my previous PR, i got a comment to change it to 777.
#549 (comment)

// below the wd, and therefore the GOPATH, is recorded as "/var/..." but the
// actual process runs in "/private/var/..." and dies due to not being in the
// GOPATH because the roots don't line up.
if externalProc && runtime.GOOS == "darwin" && needsPrivateLeader(new.tempdir) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than duplicating all the code + comment, let's please extract it out into a func and use that in both places.

@sdboyer
Copy link
Member

sdboyer commented May 21, 2017

OK, LGTM. Thank you, and yay first contribution! 🎉 🎉

@sdboyer sdboyer merged commit 155a6de into golang:master May 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants