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.
Pros
gpm bootstrap
is intended to help users adopt gpm by creating a Godeps dependency file based on the Go code of a project, management of the Godeps file after this initial creation is up to the user but gpm ensures that they have a decent starting point, this makes it easier for beginners.(This PR references issue #18)
Sample usage:
Cons
This is a rather complex feature, and and imperfect one too. As a discussion starting point we can see that this PR takes
bin/gpm
from 78 LOC to 179, which speaks volumes: is the complexity inherent to this feature worth the readability/maintenance overhead for the project? I'm not sure, I would hope we can discuss that in this PR.The second downside is that this feature is imperfect: it uses
go list
to get a list of packages imported in your Go project, but this listing is not straight forward to use: it includes subpackages too, you can see this in the following sample usage:What rule should I use to determine which if these import paths I actually want in my Godeps file considering they are the same repository? I've "solved" this by having
gpm bootstrap
only consider top level packages (I.E: where the import path corresponds to a $GOPATH/src/<import_path> directory).This is imperfect because it will ignore Go packages that don't have a top-level package, maybe a repository has a list of subpackages which you import but if the repo root itself is not a package then it will be ignored.
I think this should not be a big issue because in practice repositories that don't have a top-level package tend to be applications, not libraries, and so you're not likely to be importing those, but it does make this feature imperfect in gpm for some use cases without a doubt.
Summary
This feature provides a nicer user experience, but adds a non-trivial amount of complexity and is imperfect. Should it be added?