go: cmd/go: go get can block for extremely long periods of time without any indication of functionality
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 https://github.com/golang/go/issues/18388 https://github.com/golang/go/issues/22356 https://github.com/golang/go/issues/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).
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 17 (8 by maintainers)
I could have sworn I grepped the help and didn’t find it, but there it is. Gah. I probably fail at grep.
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.Please read carefully what I wrote.
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 makingget
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:or something like that.
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.
dep (https://github.com/golang/dep) is a WIP package manager for Go that is similar to the other package managers you keep mentioning.
2018-01-05 11:58 GMT+01:00 Connor Wolf notifications@github.com: