-
Notifications
You must be signed in to change notification settings - Fork 1k
ensure: provide a way to remove unwanted entries from Gopkg.toml #1470
Comments
#302 - I know, embarrassingly old - is about adding warnings for ineffectual items. it's won't be automated, but at least you don't have to figure out what to remove yourself.. would you consider that good enough? |
I'd prefer there to be a way of doing it automatically. Much like Go import statements, I'm not sure that it's ever appropriate to have repos mentioned that aren't used. |
Is the only workaround to manually edit the Gopkg file? |
@cmcginty yes. @rogpeppe huh. yknow, I've never thought of those being directly analogous in quite that way before, but it's a really interesting parallel, now that you make it. unfortunately, our hands are rather tied with respect to doing this in an automated way, as that would entail rewriting the |
@sdboyer I wondered if that was the case. I wonder how hard it would be to be able to preserve comments when rewriting TOML. A few different possible approaches come to mind. (Aside: it's for reasons like this that I respect the JSON decision to omit comments from the spec.) |
to be clear, this was an intentional choice - TOML having comments was an essential part of the design, and we made certain sacrifices to allow it - including the possibility of things like this. however, if a comment-preserving TOML implementation were to appear, I'd be down with revisiting things like this in a heartbeat. in the meantime, though, automated trimming would best be implemented as a standalone tool. shouldn't be too difficult to do. |
When I remove a dependency from a project, I'd like all unwanted entries
in Gopkg.toml to go away ASAP. I don't see that there's a way to do that currently
without manually checking each dependency.
It's perhaps arguable that
dep ensure -add
could do this automatically, as it may well be what most people want most of the time, although that doesn't fit very well with the name "add".Perhaps:
dep ensure -constraints
might work for ensuring that both Gopkg.toml and Gopkg.lock are up to date.
Alternatively,
dep init
could be made to work with existing Gopkg.toml and Gopkg.lock files.The text was updated successfully, but these errors were encountered: