{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/27580","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/27580/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/27580/comments","events_url":"https://api.github.com/repos/golang/go/issues/27580/events","html_url":"https://github.com/golang/go/issues/27580","id":358377314,"node_id":"MDU6SXNzdWUzNTgzNzczMTQ=","number":27580,"title":"cmd/go: show the help message instead of suggesting \"go help subcommand\" when the --help/-h flag is passed","user":{"login":"fatih","id":438920,"node_id":"MDQ6VXNlcjQzODkyMA==","avatar_url":"https://avatars1.githubusercontent.com/u/438920?v=4","gravatar_id":"","url":"https://api.github.com/users/fatih","html_url":"https://github.com/fatih","followers_url":"https://api.github.com/users/fatih/followers","following_url":"https://api.github.com/users/fatih/following{/other_user}","gists_url":"https://api.github.com/users/fatih/gists{/gist_id}","starred_url":"https://api.github.com/users/fatih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatih/subscriptions","organizations_url":"https://api.github.com/users/fatih/orgs","repos_url":"https://api.github.com/users/fatih/repos","events_url":"https://api.github.com/users/fatih/events{/privacy}","received_events_url":"https://api.github.com/users/fatih/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-09T13:09:13Z","updated_at":"2018-09-09T13:09:13Z","closed_at":null,"author_association":"MEMBER","body":"### What version of Go are you using (`go version`)?\r\n\r\n```\r\ngo version go1.11 darwin/amd64\r\n```\r\n\r\n### Does this issue reproduce with the latest release?\r\n\r\nyes\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n\r\n```\r\n$ go env\r\nGOARCH=\"amd64\"\r\nGOBIN=\"/Users/fatih/go/bin\"\r\nGOCACHE=\"/Users/fatih/Library/Caches/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/fatih/go\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/Cellar/go/1.11/libexec\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"clang\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\nGOMOD=\"\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/k_/87syx3r50m93m72hvqj2qqlw0000gn/T/go-build154500786=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\n```\r\n\r\n### What did you do?\r\n\r\nI asked to print the help usage of the command `go list`:\r\n\r\n```\r\n$ go list --help\r\nusage: go list [-f format] [-json] [-m] [list flags] [build flags] [packages]\r\nRun 'go help list' for details.\r\n```\r\n\r\n### What did you expect to see?\r\n\r\nI would like to see the help output instead of suggesting me to run `go help list`. \r\n\r\n```\r\n$ go list --help\r\nusage: go list [-f format] [-json] [-m] [list flags] [build flags] [packages]\r\n\r\nList lists the named packages, one per line.\r\nThe most commonly-used flags are -f and -json, which control the form\r\nof the output printed for each package. Other list flags, documented below,\r\ncontrol more specific details.\r\n```\r\n\r\n### What did you see instead?\r\n\r\nIt suggested to me to run `go help list`. \r\n\r\nI think this is a not very user friendly output. `--help`  (or `-h`) is a very common flag and is even parsed by the `flag` package. The `go` command understand that I'm seeking for a help, instead of suggesting me to run `go help list`, it should show me the help message.\r\n\r\n\r\nAs an example user case, suppose you run a command and somehow wrote it wrong:\r\n\r\n```\r\n$  go list -f\r\nflag needs an argument: -f\r\nusage: go list [-f format] [-json] [-m] [list flags] [build flags] [packages]\r\nRun 'go help list' for details.\r\n```\r\n\r\nIf the `go` command would support the `--help`/`-h` flags, I could press the `up` key on my keyboard  (_the shell would show the last executed command_) and append the `--help` flag to see what's wrong:\r\n\r\n```\r\n$  go list -f --help\r\nusage: go list [-f format] [-json] [-m] [list flags] [build flags] [packages]\r\n\r\nList lists the named packages, one per line.\r\nThe most commonly-used flags are -f and -json, which control the form\r\nof the output printed for each package. Other list flags, documented below,\r\ncontrol more specific details.\r\n\r\n...\r\n```\r\n\r\nThis example is not only about `go list` itself, this applies to every single subcommand of the `go` command. This happens so many times and I think it's counter intuitive to write a comand from scratch (i.e: `go help list`, `go help test`, ...).  I don't know the origin why `--help` or `-h` is permitted and not allowed to be used, but if it's something that can be removed, I suggest we remove the restriction and show the help message instead of suggesting to call `go help subcommand` (_for subcommand related --help messages_).\r\n\r\n"}}
{"actor":{"display_login":"fatih"}}