Giter Site home page Giter Site logo

ensure: handle if dep is unused? about dep HOT 7 CLOSED

golang avatar golang commented on May 10, 2024
ensure: handle if dep is unused?

from dep.

Comments (7)

adg avatar adg commented on May 10, 2024

This SGTM

from dep.

sdboyer avatar sdboyer commented on May 10, 2024

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.

from dep.

jessfraz avatar jessfraz commented on May 10, 2024

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

from dep.

jessfraz avatar jessfraz commented on May 10, 2024

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

from dep.

jessfraz avatar jessfraz commented on May 10, 2024

so actually I think it should possibly behave like this:

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

or something like that

from dep.

sdboyer avatar sdboyer commented on May 10, 2024

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

$ dep ensure github.com/Sirupsen/[email protected]
# 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/[email protected] to guarantee it is always present in lock and vendor, regardless of whether your code imports it.

from dep.

sdboyer avatar sdboyer commented on May 10, 2024

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

from dep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.