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

status: adding counts to verbose output #1037

Merged
merged 1 commit into from
Aug 21, 2017
Merged

status: adding counts to verbose output #1037

merged 1 commit into from
Aug 21, 2017

Conversation

jmank88
Copy link
Collaborator

@jmank88 jmank88 commented Aug 18, 2017

What does this do / why do we need it?

Small tweak to verbose status output adding counts so that progress can be roughly monitored.
Before:

Checking upstream projects:
cloud.google.com/go
github.com/Azure/azure-sdk-for-go
... (many more projects)
gopkg.in/yaml.v2
honnef.co/go/tools
PROJECT ...
... (table)

After:

Checking upstream projects:
(1/129) cloud.google.com/go
(2/129) github.com/Azure/azure-sdk-for-go
... (many more projects)
(128/129) gopkg.in/yaml.v2
(129/129) honnef.co/go/tools

PROJECT ...
... (table)

Which issue(s) does this PR fix?

Follow up from #1009, related to #1008

@jmank88
Copy link
Collaborator Author

jmank88 commented Aug 19, 2017

I like the idea of using this (#/total) format to show progress when it makes sense, rather than dynamic console output for something like progress bars #1001.

If others are on board, it could be added to some other existing output, like:

...
Locking in v1.7.3 (be5ece7) for transitive dep github.com/magiconair/properties
Locking in v0.2.0 (8ab6407) for transitive dep github.com/coreos/go-semver
Locking in v0.2.1 (990a1a1) for transitive dep github.com/docker/go-connections
Locking in v1.1 (1ea2538) for transitive dep github.com/gorilla/context
...

Or:

...
Writing out github.com/mitchellh/mapstructure@master
Writing out github.com/giantswarm/[email protected]
Writing out github.com/opencontainers/[email protected]
Writing out github.com/moby/[email protected]
Writing out github.com/Azure/go-ansiterm@master
Writing out github.com/gin-contrib/sse@master
...

Edit: Dry run output (PrintPreparedActions)

Related #1038

for _, proj := range slp {
logger.Println(proj.Ident().ProjectRoot)
for i, proj := range slp {
logger.Printf("(%d/%d) %s\n", i+1, len(slp), proj.Ident().ProjectRoot)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does go lift the len computation out of the loop?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, but there is not really any "computation" going on. Slice lengths are stored in the slice internal struct representation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh nice! 👍 Thanks for the explanation.

Copy link
Collaborator

@ibrasho ibrasho left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants