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

cmd/go: go test -cover hangs with import cycles #9690

Closed
aybabtme opened this issue Jan 26, 2015 · 2 comments
Closed

cmd/go: go test -cover hangs with import cycles #9690

aybabtme opened this issue Jan 26, 2015 · 2 comments
Milestone

Comments

@aybabtme
Copy link

Hello Gophers!

  1. go version go1.4.1 darwin/amd64
  2. OS X Yosemite, amd64.
  3. Ran go test -cover . in a package with import cycle in the tests.
  4. It should fail to compile the tests.
  5. It didn't fail and hang instead.

to reproduce

Fetch repository github.com/aybabtme/hangcover and run ./reproduce.sh.

$ ./reproduce.sh
GOROOT=$(go env GOROOT)
go env GOROOT
GIT_DIR="$GOROOT/.git" git rev-parse --verify HEAD
886b02d705ffb1be8b4974ac4c355d480a24e3ec

go version
go version go1.4.1 darwin/amd64
go test -cover github.com/aybabtme/hangcover
^C⏎

description

If a test file has the same package name as the package it tests,
and if that test file imports the package it tests:

// hangcover.go
package hangcover
// hangcover_test.go
package hangcover

import "github.com/aybabtme/hangcover"

Then running go test github.com/aybabtme/hangcover will fail with an import cycle error:

# github.com/aybabtme/hangcover
./hang_test.go:4: import "github.com/aybabtme/hangcover" while compiling that package (import cycle)
FAIL    github.com/aybabtme/hangcover [build failed]

But running go test -cover github.com/aybabtme/hangcover will hang:

go test -cover github.com/aybabtme/hangcover
^C⏎
@aybabtme aybabtme changed the title go test -cover hangs with import cycles. cmd/test: go test -cover hangs with import cycles. Jan 26, 2015
@minux minux changed the title cmd/test: go test -cover hangs with import cycles. cmd/go: go test -cover hangs with import cycles Jan 26, 2015
@minux minux added this to the Go1.4.2 milestone Jan 26, 2015
@adg adg modified the milestones: Go1.4.3, Go1.4.2 Feb 17, 2015
@ianlancetaylor
Copy link
Contributor

Problems with invalid code need not be fixed in minor releases.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.5, Go1.4.3 Apr 6, 2015
@rsc rsc removed the repo-main label Apr 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/12147 mentions this issue.

@rsc rsc closed this as completed in 023047d Jul 15, 2015
@golang golang locked and limited conversation to collaborators Jul 18, 2016
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

6 participants