Skip to content

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

Closed

Description

@namusyaka

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)

Activity

  1. gopherbot commented on Oct 23, 2017

    @gopherbot
    Contributor

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

  2. 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.[/+] on Oct 23, 2017
  3. ianlancetaylor commented on Oct 23, 2017

    @ianlancetaylor
    Contributor

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

  4. ianlancetaylor commented on Oct 23, 2017

    @ianlancetaylor
    Contributor

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

  5. namusyaka commented on Oct 31, 2017

    @namusyaka
    MemberAuthor

    Could you take a look at the cl?

  6. namusyaka commented on Nov 18, 2017

    @namusyaka
    MemberAuthor

    Any chance for this to be considered for 1.10?

  7. ianlancetaylor commented on Nov 19, 2017

    @ianlancetaylor
    Contributor

    It's in now. Thanks.

  8. locked and limited conversation to collaborators on Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions