{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/29062","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/29062/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/29062/comments","events_url":"https://api.github.com/repos/golang/go/issues/29062/events","html_url":"https://github.com/golang/go/issues/29062","id":386533661,"node_id":"MDU6SXNzdWUzODY1MzM2NjE=","number":29062,"title":"cmd/go: test seems to succeed even if some test calls os.Exit(0)","user":{"login":"rhysd","id":823277,"node_id":"MDQ6VXNlcjgyMzI3Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/823277?v=4","gravatar_id":"","url":"https://api.github.com/users/rhysd","html_url":"https://github.com/rhysd","followers_url":"https://api.github.com/users/rhysd/followers","following_url":"https://api.github.com/users/rhysd/following{/other_user}","gists_url":"https://api.github.com/users/rhysd/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysd/subscriptions","organizations_url":"https://api.github.com/users/rhysd/orgs","repos_url":"https://api.github.com/users/rhysd/repos","events_url":"https://api.github.com/users/rhysd/events{/privacy}","received_events_url":"https://api.github.com/users/rhysd/received_events","type":"User","site_admin":false},"labels":[{"id":373401956,"node_id":"MDU6TGFiZWwzNzM0MDE5NTY=","url":"https://api.github.com/repos/golang/go/labels/NeedsDecision","name":"NeedsDecision","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/83","html_url":"https://github.com/golang/go/milestone/83","labels_url":"https://api.github.com/repos/golang/go/milestones/83/labels","id":3730798,"node_id":"MDk6TWlsZXN0b25lMzczMDc5OA==","number":83,"title":"Go1.13","description":null,"creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":212,"closed_issues":18,"state":"open","created_at":"2018-10-11T15:30:19Z","updated_at":"2018-12-05T06:45:04Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2018-12-02T06:59:05Z","updated_at":"2018-12-05T13:42:08Z","closed_at":null,"author_association":"NONE","body":"<!-- Please answer these questions before submitting your issue. Thanks! -->\r\n\r\n### What version of Go are you using (`go version`)?\r\n\r\n<pre>\r\n$ go version\r\ngo version go1.11.2 darwin/amd64\r\n</pre>\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<details><summary><code>go env</code> Output</summary><br><pre>\r\n$ go env\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/Users/rhysd/Library/Caches/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/rhysd/.go\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/Cellar/go/1.11.2/libexec\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/usr/local/Cellar/go/1.11.2/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/9t/jwm1hlr905g_wlnzrmbnb3cr0000gn/T/go-build385579133=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\n</pre></details>\r\n\r\n### What did you do?\r\n\r\n<!--\r\nIf possible, provide a recipe for reproducing the error.\r\nA complete runnable program is good.\r\nA link on play.golang.org is best.\r\n-->\r\n\r\nHere is a code snip to explain this issue:\r\n\r\n```go\r\npackage foo\r\n\r\nimport (\r\n\t\"os\"\r\n\t\"testing\"\r\n)\r\n\r\ntype Parsed struct{}\r\n\r\nfunc parseArguments(args []string) (Parsed, error) {\r\n\t// parse arguments\r\n\tif len(args) == 0 {\r\n\t\t// Show help message\r\n\t\tos.Exit(0)\r\n\t}\r\n\r\n\t// check parsed arguments\r\n\r\n\treturn Parsed{}, nil\r\n}\r\n\r\nfunc TestParse(t *testing.T) {\r\n\t_, err := parseArguments([]string{})\r\n\tif err != nil {\r\n\t\tt.Fatal(err)\r\n\t}\r\n\t// test parse result\r\n}\r\n\r\nfunc TestOther(t *testing.T) {\r\n\tt.Fatal()\r\n}\r\n```\r\n\r\nPlease write above code to some Go file and run:\r\n\r\n```\r\n$ go test\r\n$ echo $?\r\n```\r\n\r\nIt outputs `0`. So it means that test is ok. However, actually test has stopped at the middle of execution since `os.Exit(0)` is accidentally called.\r\nI'm not sure that this is a bug. It may be intended behavior. But when calling `os.Exit(0)` in tests accidentally (for example, due to lack of understanding of API), I may not notice the tests are wrongly run since it exits successfully. CI also cannot detect it.\r\n\r\n### What did you expect to see?\r\n\r\nIMO, `go test` exiting with non-zero exit status when the tests exit at the middle of execution by `os.Exit()` would solve this issue.\r\n\r\n### What did you see instead?\r\n\r\n`echo $?` echoes `0` and test exited successfully"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/444488905","html_url":"https://github.com/golang/go/issues/29062#issuecomment-444488905","issue_url":"https://api.github.com/repos/golang/go/issues/29062","id":444488905,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDQ4ODkwNQ==","user":{"login":"bcmills","id":5200974,"node_id":"MDQ6VXNlcjUyMDA5NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5200974?v=4","gravatar_id":"","url":"https://api.github.com/users/bcmills","html_url":"https://github.com/bcmills","followers_url":"https://api.github.com/users/bcmills/followers","following_url":"https://api.github.com/users/bcmills/following{/other_user}","gists_url":"https://api.github.com/users/bcmills/gists{/gist_id}","starred_url":"https://api.github.com/users/bcmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcmills/subscriptions","organizations_url":"https://api.github.com/users/bcmills/orgs","repos_url":"https://api.github.com/users/bcmills/repos","events_url":"https://api.github.com/users/bcmills/events{/privacy}","received_events_url":"https://api.github.com/users/bcmills/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T13:42:08Z","updated_at":"2018-12-05T13:42:08Z","author_association":"MEMBER","body":"I did some experimenting and it looks like I was just mistaken. Carry on!"}}
{"actor":{"display_login":"bcmills"}}