Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for visualizing and updating dependencies (within Gopkg.toml constraints) in dep-enabled projects. #82

Merged
merged 2 commits into from
Aug 22, 2017

Conversation

dmitshur
Copy link
Member

@dmitshur dmitshur commented Aug 21, 2017

This PR adds support for dep and resolves #81. /cc @sdboyer @bits01 @bradleyfalzon

A new -dep flag is added. Using it requires dep binary to be available in PATH. When -dep flag is set to point to a Gopkg.toml file of a dep-enabled project, it runs dep status in the containing directory to determine available updates (within Gopkg.toml constraints) and then displays them in a visual form.

The Update (and Update All) buttons are functional. Pressing them executes dep ensure -update {root} command in same directory, causing the update to be applied.

E.g.:

$ Go-Package-Store -dep=/Users/Gopher/go/src/github.com/bradleyfalzon/gopherci/Gopkg.toml
Determining the list of Go packages from Gopkg.toml file: /Users/Gopher/go/src/github.com/bradleyfalzon/gopherci/Gopkg.toml
Go Package Store server is running at http://localhost:7043/updates.

dep ensure -update github.com/google/go-github
Done.

image

This is the first naive implementation. It reads Gopkg.lock file
directly to figure out the base versions of all dependencies, and uses
usual logic to figure out latest versions of each dependency. This in
turn bypasses the constraints set in Gopkg.toml file.

That is not acceptable because it's not helpful to the user to see
these updates without distinction of what is within the Gopkg.toml
constraints and without. Also, the update button will do the wrong
thing, as it updates via dep ensure -update which does respect
Gopkg.toml constraints.

Helps #81.
This change implements correct behavior, where the displayed updates
are within the Gopkg.toml constraints as determined by dep status
command.

We defer the work of determining remotely available updates to dep,
since there's no easy way to perform constraint checking on our end.
For now, this is a simple solution that works. In the future, a more
elaborate setup can be considered, if needed to have better performance
or implement certain additional features.

Resolves #81.
Dir string
}

func (d Dep) Update(repo *gps.Repo) error {
Copy link

Choose a reason for hiding this comment

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

golint: exported method Dep.Update should have comment or be unexported

Copy link
Member Author

Choose a reason for hiding this comment

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

Ignoring because this implements an interface, and I don't want to copy/paste the interface documentation into multiple places, causing it to more easily fall out of date.

I could write a // Update implements Updater interface., but it doesn't seem worth it at this point.

@dmitshur dmitshur mentioned this pull request Aug 21, 2017
@bradleyfalzon
Copy link

This is great, going to give it a test shortly. Did you want to update the README.md with a similar example to the PR's?

@dmitshur
Copy link
Member Author

dmitshur commented Aug 21, 2017

Did you want to update the README.md with a similar example to the PR's?

Sorry, I don't understand what you mean by that. Can you rephrase?

README.md is already updated to include the new Go-Package-Store -help output, which includes a new usage example. Isn't it so?

@bradleyfalzon
Copy link

which includes a new usage example. Isn't it?

Argh, yes, sorry, I must have skipped over that file when I looked, ignore my comment!

@dmitshur dmitshur merged commit 9bf5d32 into master Aug 22, 2017
@dmitshur dmitshur deleted the dep-support branch August 22, 2017 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dep
2 participants