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

ensure: handle if dep is unused? #36

Closed
jessfraz opened this issue Dec 9, 2016 · 7 comments
Closed

ensure: handle if dep is unused? #36

jessfraz opened this issue Dec 9, 2016 · 7 comments
Assignees
Labels

Comments

@jessfraz
Copy link
Contributor

jessfraz commented Dec 9, 2016

I kinda like the behavior now but we should decide on it.

if you run dep ensure now with a dep you are not currently using it will add it to the manifest but not the lock.

After you've added your code using the dep, you can rerun dep ensure and it will be in the lock as well.

I personally like this because i like to checkout packages locally before starting coding for goimports and code completion but we should decide if this is the behavior everyone wants.

@adg
Copy link
Contributor

adg commented Dec 12, 2016

This SGTM

@sdboyer
Copy link
Member

sdboyer commented Dec 13, 2016

i'm glad you like that behavior, b/c it's the simplest way of making this work :)

the only thing about it is, if you ensure w/out it being imported it's not in the lock OR vendor. or anywhere in your GOPATH. so it doesn't actually help with goimports/code completion.

there's one other easy possibility i've thought of, here - we could inject the named package with a require into the manifest we pass to Solve(), but NOT into the manifest on disk. that way the proj make it into the lock and vendor, enabling code completion. on a subsequent ensure, if the user still hasn't added an actual import for that project, it'll disappear from the lock and vendor. sdboyer/gps#42

idk which of these causes more WTF.

@jessfraz
Copy link
Contributor Author

so basically I'm going to write a test ensuring (hahaha pun) we never break this behavior, then I will close this

@jessfraz jessfraz self-assigned this Jan 17, 2017
@jessfraz
Copy link
Contributor Author

except I kinda want the behavior @sdboyer mentioned as:

we could inject the named package with a require into the manifest we pass to Solve(), but NOT into the manifest on disk. that way the proj make it into the lock and vendor, enabling code completion. on a subsequent ensure, if the user still hasn't added an actual import for that project, it'll disappear from the lock and vendor

@jessfraz
Copy link
Contributor Author

jessfraz commented Jan 17, 2017

so actually I think it should possibly behave like this:

$ dep ensure github.com/Sirupsen/logrus@v0.11.0
# warn: you have requested github.com/Sirupsen/logrus but it is not imported in your code 
# run dep ensure --require github.com/Sirupsen/logrus@v0.11.0 to add it to the vendor and lock

or something like that

@sdboyer
Copy link
Member

sdboyer commented Jan 18, 2017

cool! @jessfraz i was imagining this, a small tweak on what you had:

$ dep ensure github.com/Sirupsen/logrus@v0.11.0
# warn: you have requested github.com/Sirupsen/logrus but it is not imported in your code.
# It will be added to lock and vendor now, but removed if dep ensure is run again without importing it.
# run dep ensure --require github.com/Sirupsen/logrus@v0.11.0 to guarantee it is always present in lock and vendor, regardless of whether your code imports it.

@sdboyer
Copy link
Member

sdboyer commented Feb 22, 2017

Closing this out, as I think the new direction defined in #213 obviates it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants