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

testing: error message is wrong when a typo error exists in TestMain. #22388

Closed
namusyaka opened this issue Oct 23, 2017 · 6 comments
Closed

Comments

@namusyaka
Copy link
Member

What version of Go are you using (go version)?

go version devel +006bc57095

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/numb/workspace/private/go/go"
GORACE=""
GOROOT="/Users/numb/workspace/private/go/go"
GOTOOLDIR="/Users/numb/workspace/private/go/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6b/hxgkjy5d2d1b1633hq3slp14sf3ny_/T/go-build078552962=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

If I have a typo about argument of TestMain, the displayed message seems wrong.

https://play.golang.org/p/Fe6F7R8qKi

What did you expect to see?

wrong signature for TestMain, must be: func TestMain(m *testing.M)

What did you see instead?

wrong signature for TestMain, must be: func TestMain(t *testing.T)

@gopherbot
Copy link

Change https://golang.org/cl/72591 mentions this issue: testing: fix invalid error message about argument of TestMain

@namusyaka namusyaka changed the title testing: error message is wrong which is displayed when a typo error exists in TestMain. testing: error message is wrong when a typo error exists in TestMain. Oct 23, 2017
@ianlancetaylor
Copy link
Contributor

I believe the error message is correct. The special name TestMain has a special meaning, as described at https://golang.org/pkg/testing.

@ianlancetaylor
Copy link
Contributor

Oh, sorry, I completely misread this report. Please ignore my comment.

@namusyaka
Copy link
Member Author

Could you take a look at the cl?

@namusyaka
Copy link
Member Author

Any chance for this to be considered for 1.10?

@ianlancetaylor
Copy link
Contributor

It's in now. Thanks.

@golang golang locked and limited conversation to collaborators Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants