Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

[WIP] New status run modes #613

Closed
wants to merge 3 commits into from
Closed

Conversation

darkowlzz
Copy link
Collaborator

NOTE: This is just an experiment to discuss about the behavior of status and it's running modes.

This PR adds the following modes to status command:

  • -unused - show unused dependencies
  • -missing - show missing dependencies
  • -old - show out-of-date dependencies

There are a lot of repeated code in this PR in status.go file. They would be refactored once we discuss and decide how we want things to be in status.

Following are the output of status with the new modes. Need feedback on how can they be improved and their proper implementation.

-unused

When there are unused dependencies:

$ dep status -unused
Unused dependencies present in manifest:

  github.com/golang/lint
  github.com/foo/bar

When there are no unused dependencies:

$ dep status -unused
No unused dependencies found.

-missing

When there are missing dependencies:

$ dep status -missing
Missing dependencies (not present in lock):

  github.com/darkowlzz/openurl
  github.com/fsnotify/fsnotify

When there are no missing dependencies:

$ dep status -missing
No missing dependencies found.

-old

When there are out-of-date dependencies:

$ dep status -old
Following are the out-of-date dependencies:

github.com/fsnotify/fsnotify is on fd9ec7deca8bf46ecd2a795baaacf2b3a9be1197, latest available is 4da3e2cfbabc9f751898f250b49f2439785783a1
github.com/sdboyer/deptest is on 3f4c3bea144e112a69bbe5d8d01c1b09a544253f, latest available is ff2948a2ac8f538c4ecd55962e919d1e13e74baf
golang.org/x/sys is on ca83bd2cb9abb47839b50eb4da612f00158f5870, latest available is a2e06a18b0d52d8cb2010e04b372a1965d8e3439

This really needs a better table view output.

When all the dependencies are up-to-date:

$ dep status -old
All the dependencies are up-to-date.

This mode considers transitive dependencies too. Should this update availability check be only for direct dependencies or for all the dependencies?


Q:

  • The above outputs don't use any table view and are not detailed. Do we need more details for each of them in table format?
  • Are any of these modes not necessary?
  • Any ideas for other running modes for status that we can have?

-modified is another mode that can be implemented to show what changed. But I'm not sure what are the things that should be considered for modified. Some inputs would be great.

Adds runStatusUnused() to analyse and show only the unused dependencies
in the project.
Adds runStatusMissing() to analyse and show only the missing
dependencies in the project.
Adds runStatusOld() to analyse and list the out-of-date dependencies in
the project.
@darkowlzz
Copy link
Collaborator Author

@sdboyer some feedback on this for progress and improvements?

@dmitshur
Copy link
Contributor

Question, how do these flags intersect with -json flag?

@darkowlzz
Copy link
Collaborator Author

@shurcooL I don't think I had json output in mind when this PR was written. But now I see we should consider json and other relevant supported output formats for each of the different status modes.

In case of -old flag, I see the json output to be something like:

[
  {
    "project": "github.com/fsnotify/fsnotify",
    "version": "v1.11.1"
    "revision": "fd9ec7deca8bf46ecd2a795baaacf2b3a9be1197",
    "latest": "4da3e2cfbabc9f751898f250b49f2439785783a1"
  },
  {
    "project": "github.com/pkg/errors",
    ...
  }
]

This should go to the spec doc: https://docs.google.com/document/d/1Qwa3jDKDh45t5qAGjRpeu3ZsAbkukIYDDmYJdMxH2uY/edit

@@ -422,6 +437,135 @@ outer:
return nil
}

// runStatusUnused analyses the project for unused dependencies that are present
// in manifest but not imported in the project.
Copy link
Member

Choose a reason for hiding this comment

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

s/in manifest/in the manifest/

@mvdan
Copy link
Member

mvdan commented Sep 4, 2020

Dep was officially deprecated earlier this year, and the proposal to archive this repository was accepted. As such, I'm closing outstanding issues before archiving the repository. For any further comments, please use the proposal thread on the Go issue tracker. Thanks!

@mvdan mvdan closed this Sep 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants