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

x/playground: test files that provide TestMain without other Test functions fail to compile #45431

Closed
bcmills opened this issue Apr 7, 2021 · 1 comment
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Apr 7, 2021

This test source file fails to compile in the Playground (https://play.golang.org/p/LabCgwBLD6d):

package main

import (
	"os"
	"testing"
)

func TestMain(m *testing.M) {
	os.Exit(0)
}
runtime.main_main·f: function main is undeclared in the main package

Go build failed.

However, it compiles and runs successfully with the actual go command:

$ go test .
ok      example.com     0.008s

-- go.mod --
module example.com

go 1.17
-- main_test.go --
package main

import (
        "os"
        "testing"
)

func TestMain(m *testing.M) {
        os.Exit(0)
}

CC @golang/release

(Compare to the failure mode in #32403.)

@gopherbot gopherbot added this to the Unreleased milestone Apr 7, 2021
@toothrot toothrot added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Apr 7, 2021
@gopherbot
Copy link

Change https://go.dev/cl/456355 mentions this issue: x/playground: allow playground to run fuzz tests

@golang golang locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants