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

cmd/go: go get can block for extremely long periods of time without any indication of functionality #23332

Closed
fake-name opened this issue Jan 4, 2018 · 17 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@fake-name
Copy link

I haven't used go before, and I'm trying to get a tool I found on github working. I just spent the last ~30 minutes assuming go get was broken, because it just sat there doing nothing for 10+ minutes.

I ran it as go get ./..., and I assumed I had done something like cat with no arguments, and it was waiting for data over stdin or something.

go get needs to output something to indicate it's actually doing anything.


I've read over #18388 #22356 #22800 and am completely unconvinced.

The consensus on those answers is:

Most go tools are quiet by default,

Uh, [citation needed]. This is completely not true.

At the moment, I can't think of a single CLI tool I use that can block for long periods of time that doesn't have some output. apt-get has some status output. git has some status output. cmake has some status output. wget has some status output.

Frankly, barring some poorly written tools of my own creation, I don't think I can recall ever seeing a tool that blocked for very long periods of time at start with absolutely no output.

I don't need a progress bar or whatnot, but as someone trying to use some go tooling for the first time, having go get print something like "fetching dependencies. this may take a while` before blocking would have been enough.


Additionally, the -v flag *is not documented. I looked at go get --help, and it's not mentioned at all (I thought about it, but assumed it wasn't supported, since the help page didn't mention it).

@bradfitz bradfitz changed the title go get can block for extremely long periods of time without any indication of functionality. proposal: cmd/go: another request for go get to show output during lengthy operations Jan 4, 2018
@gopherbot gopherbot added this to the Proposal milestone Jan 4, 2018
@fake-name
Copy link
Author

fake-name commented Jan 4, 2018

This isn't a proposal. It's a bug with the current behaviour.

I can't think of any way the current way it works is correct.

@fake-name fake-name changed the title proposal: cmd/go: another request for go get to show output during lengthy operations go get can block for extremely long periods of time without any indication of functionality Jan 4, 2018
@robpike robpike removed the Proposal label Jan 4, 2018
@robpike robpike removed this from the Proposal milestone Jan 4, 2018
@agnivade
Copy link
Contributor

agnivade commented Jan 4, 2018

Additionally, the -v flag *is not documented. I looked at go get --help, and it's not mentioned at all

It is there in the flag description section. Although not in the usage section. That needs a fix.

The -v flag enables verbose progress and debug output.

Assuming that the -v flag is properly documented, does your use case suffice by using -v ?

The overall opinion is varied on this. Some people want their tools to be quiet and only print errors. While some think doing a -v by default is too much output. While I agree that go get ./... does take quite long to run sometimes and the experience can be very frustrating, I don't think a blanket msg saying "This might take some time" is an ideal solution.

@fake-name
Copy link
Author

fake-name commented Jan 4, 2018

It is there in the flag description section. Although not in the usage section. That needs a fix.

I could have sworn I grepped the help and didn't find it, but there it is. Gah. I probably fail at grep.

The overall opinion is varied on this. Some people want their tools to be quiet and only print errors.

Name one package manager like this that has no output by default. I've used npm, pip, apt-get, apt, pacman, yum, choco, and probably others I can't remember, and they all have status output.

There are plenty of tools that have a --silent flag, or similar, but none I can think of that are silent by default.

I do think the -v output is probably a bit much for normal operation, but no output without any indication of function for 10+ minutes is completely ridiculous, unless such behavior is specifically asked for.

@gopherbot
Copy link

Change https://golang.org/cl/85797 mentions this issue: cmd/go: add -v option in the usage section for get

@moar55
Copy link

moar55 commented Jan 4, 2018

I posted one of the issues @fake-name referenced. I agree that little indication of progress should be shown even if not a progress bar. There can be a compromise between no indication whatsoever and too detailed (verbose) indications.

@cznic
Copy link
Contributor

cznic commented Jan 4, 2018

If one wants to see what's going on, -v and/or -x provides that. Making the default noisy spams the output for all others who don't want/need it.

@ALTree
Copy link
Member

ALTree commented Jan 4, 2018

Most go tools are quiet by default,

Uh, [citation needed]. This is completely not true.

Please read carefully what I wrote.

Most go tools are quiet by default

I'm talking about go tools. Most go commands and tools by default print nothing on success. build builds packages and prints nothing, except when there's a compilation error; even if the compilation process takes half an hour. install does the same. vet prints nothing, unless it has a warning to emit. And so on.

When I write "most go tools are quiet by default" I'm thinking about internal consistency (i.e., making all go commands and tools behave in a similar way regarding when to write output).

It is also true that most tools always do their job quickly -unless you're e.g. building a huge codebase- while go get is routinely slow and it's usually the one that stumbles newcomers. I'm not sure it's worth breaking internal consistency by making get emit output by default, considering that you already have a way to make it verbose (-v, similar to other commands).

One thing we could do is make more clear that the command is silent by default, for example in go get --help, after the short description but before the flags list:

The command is quiet by default, and emits no output unless an error occurs. To make it verbose, ..

or something like that.

@ALTree ALTree changed the title go get can block for extremely long periods of time without any indication of functionality cmd/go: go get can block for extremely long periods of time without any indication of functionality Jan 4, 2018
gopherbot pushed a commit that referenced this issue Jan 4, 2018
Updates #23332

Change-Id: I964d36ed751ef1844ab6c40f61047297ff1443a3
Reviewed-on: https://go-review.googlesource.com/85797
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@fake-name
Copy link
Author

fake-name commented Jan 4, 2018

I'm talking about go tools. Most go commands and tools by default print nothing on success.

Point taken.

In that case, the entire go ecosystem has broken assumptions, that makes it inconsistent with every other ecosystem I've ever touched.

Making the default noisy spams the output for all others who don't want/need it.

Who exactly doesn't want it?

Functionally, it's a package manager. It should be expected to operate like every other package manager, or if you're going to break with consistency, there should be a good reason. "Other go CLI tools are quiet" is not a good reason, particularly when you realize that the package manager is one of the first things people come into contact with when trying to use the language.

Note: I personally think a package manager acting like a package manager is much more important then it being consistent with other go tools. YMMV

All this started because I just wanted to execute a program written in go. The way it works now, "normal behaviour" is indistinguishable from the tool being broken, unless you blindly let it sit at the command prompt seemingly doing nothing for 10+ minutes (at least in some cases).

It doesn't even use enough CPU to indicate it's doing something (presumably because it's blocked on network stuff).

@cznic
Copy link
Contributor

cznic commented Jan 4, 2018

Who exactly doesn't want it?

Many unix-y programmers. It's how most unix tools work - for decades.

Functionally, it's a package manager. It should be expected to operate like every other package manager, or if you're going to break with consistency, there should be a good reason.

It's the opposite. Unix tools are consistently quiet until they have to say something.

"Other go CLI tools are quiet" is not a good reason, particularly when you realize that the package manager is one of the first things people come into contact with when trying to use the language.

It should be easy to make an alias for the go get command that adds -v and/or -x. Forcing the noisy output is your preference, no problem with that, but it's not automatically the "right thing" because of that.

All this started because I just wanted to execute a program written in go. The way it works now, "normal behaviour" is indistinguishable from the tool being broken, unless you blindly let it sit at the command prompt seemingly doing nothing for 10+ minutes (at least in some cases).

You're probably coming from Windows, I guess. I can tell you that I understand your pain very well. I have the same desperate feeling of nothing working as expected when I occasionally must use Windows. But forcing unix expectations to all Windows users would be a patently bad idea, do you agree?

@fake-name
Copy link
Author

fake-name commented Jan 4, 2018

You're probably coming from Windows, I guess.

Nope. I do almost all my dev work on linux.

Unix tools are consistently quiet until they have to say something.

Name one package manager that's silent default.

Forcing the noisy output is your preference, no problem with that, but it's not automatically the "right thing" because of that.

Well, apt-get, yum, pip, npm, and (it's been a while) pacman are all not silent by default, so if you come into this from the perspective of having used any other package manager on linux, status output is the standard.

@cznic
Copy link
Contributor

cznic commented Jan 5, 2018

Nope. I do almost all my dev work on linux.

The Times They Are a-Changin'

Unix tools are consistently quiet until they have to say something.

Name one package manager that's silent default.

I'm talking about unix tools and I do not even consider go get to be a package manager. You insist on talking about package managers instead as if they're not unix tools. Yes, some modern unix tools do not keep the well established tradition of tool being quiet by default when their purpose is other than to produce output. Yes, I consider it bad practice. If I want to know what apt-get or git is doing, I prefer to ask for it, not by default ruining the visual context of what I've been doing in the terminal in the previous commands, because now they are either many lines away from the screen or lost completely when the scroll buffer is set to a fixed length.

But this all is in accordance with how all the good values of unix are being slowly ruined in general. systemd anyone?

@fake-name
Copy link
Author

fake-name commented Jan 5, 2018

I'd even go more general then package manager, and say name one linux CLI tool that can block for > 1 second and has no CLI output. The only thing I can think of is cp on a very, very large directly.

And yes, I'm talking about package managers, because that's what go get is, and the expectations for it should be commensurate.

You mention git. It has status output too!. I think maybe you need to recognize that "linux CLI tools are silent by default" was never true. They generally should be simple, and do one thing well, but neither of those have anything to do with their output. If you don't want to see the output, just pipe it to /dev/null or something.

Frankly, I bought up package managers because I think they're a great example of a complex unix CLI tool. As far as I know, they started on *NIX, so the fact that they are not completely silent kind of directly contravenes the entire "silent-by-default is unixy" argument.

Heck, looking at dpkg from 1994, and yep, it has status output.

@cznic
Copy link
Contributor

cznic commented Jan 5, 2018

And yes, I'm talking about package managers, because that's what go get is, and the expectations for it should be commensurate.

Sounds like a ruling from an authority with decisive power about this question. There's nothing to add.

@ALTree
Copy link
Member

ALTree commented Jan 5, 2018 via email

@fake-name
Copy link
Author

go get is not a package manager, it doesn't have have the concept of
'version'. It's more correct to see it as a simple Go package downloader.

Well, point taken.

Can we say it should act like wget and output status, then?

@ALTree
Copy link
Member

ALTree commented Jan 5, 2018 via email

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 15, 2018
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Feb 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants