dep status -old should list the dependencies that are out-of-date.
Refer: command spec
~Example code: #613~
Would you add more detail? @darkowlzz
@azbshiri yes, so dep status shows status of all the project dependencies (direct and transitive) and it also shows the latest revision of those dependencies allowed by their constraints. When REVISION and LATEST are not the same, it means there's a newer version available for the dependency project. But that's kinda information overload.
With -old flag, we would like to filter out only the projects that have a newer version available allowed by the set constraints, if any. For a branch constraint, it would mean a new revision on the same branch. For a semver constraint, it would mean a new semver release within the constrained semver.
The result should be in table format as well as in json format, compatible with -json flag.
There are some examples of how the output should look like at the bottom of the command spec doc. Have a look.
Also, you can refer to runUpdate() in ensure, which updates a project by performing a gps solve and writes to file. In this case, we just need the update info. So you can skip the writing part.
And ignore the algorithm in #613 for checking update. That's an old implementation and I see it tries to fetch update without a gps solve, that could lead to incorrect/incompatible suggestions. Use the runUpdate() approach in ensure.go.
Hope this helps 馃槉
@darkowlzz Hey, I'm working on this. But I have problem with the solver after preparation how can I identify which dependency is out of sync? is this has something to do with Lock.InputsDigest or solver.HashInputs?
@azbshiri great! you can submit a WIP PR and show us your progress :)
But I have problem with the solver after preparation how can I identify which dependency is out of sync? is this has something to do with Lock.InputsDigest or solver.HashInputs?
So, once you have prepared a solver, solve it (solver.Solve()) and obtain a solution. From solution, you can obtain all the projects using solution.Projects(). And from the array of projects, you compare them with the existing locked set of projects we already have. Since a solve sorts and picks the latest version of the projects under the set constraint, just checking if the underlying revisions of project version are different should be enough. Use gps.VersionComponentStrings(project.Version()) to obtain the underlying revision of a project.
For sure. But it was not in a state that could be a PR. Thank you so much for the info.
What should prepare for output? I mean ctx.Out.Println("print some text to stdout")
@darkowlzz
According to the spec doc it should look like this:
$ dep status -old
PROJECT CONSTRAINT REVISION LATEST
github.com/golang/lint branch master cd8b52f 3084677
github.com/foo/bar ^0.8.0 836a144 645ef00
And that would require creating a new struct OldStatus similar to MissingStatus and BasicStatus and then some outputter methods for printing header, line and footer.
Most helpful comment
@azbshiri great! you can submit a WIP PR and show us your progress :)
So, once you have prepared a solver, solve it (
solver.Solve()) and obtain a solution. From solution, you can obtain all the projects usingsolution.Projects(). And from the array of projects, you compare them with the existing locked set of projects we already have. Since a solve sorts and picks the latest version of the projects under the set constraint, just checking if the underlying revisions of project version are different should be enough. Usegps.VersionComponentStrings(project.Version())to obtain the underlying revision of a project.