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/go2go: cannot import "go.uber.org/goleak" #41602

Closed
YoshikiShibata opened this issue Sep 24, 2020 · 1 comment
Closed

cmd/go2go: cannot import "go.uber.org/goleak" #41602

YoshikiShibata opened this issue Sep 24, 2020 · 1 comment

Comments

@YoshikiShibata
Copy link

Following program ( https://go2goplay.golang.org/p/uy8mEvhNsI2 ) cannot be compiled:

package main

import (
	"testing"

	"go.uber.org/goleak"
)

func TestX(t *testing.T) {
	defer goleak.VerifyNone(t)
}

With the go2 playground:

type checking failed for main
prog.go2:6:2: could not import go.uber.org/goleak (cannot find package "go.uber.org/goleak" in any of:
	/usr/local/go-faketime/src/go.uber.org/goleak (from $GOROOT)
	/go/src/go.uber.org/goleak (from $GOPATH))

But you can run with Go playground: https://play.golang.org/p/uy8mEvhNsI2

If I try to run this test locally, following error is printed:

type checking failed for main
x_test.go2:6:2: could not import go.uber.org/goleak (/Users/yoshiki.shibata/gocode/pkg/mod/go.uber.org/goleak@v1.1.10/tools.go:27:4: could not import golang.org/x/lint/golint (/Users/yoshiki.shibata/gocode/pkg/mod/golang.org/x/lint@v0.0.0-20190930215403-16217165b5de/golint/golint.go:19:2: could not import golang.org/x/lint (/Users/yoshiki.shibata/gocode/pkg/mod/golang.org/x/lint@v0.0.0-20190930215403-16217165b5de/lint.go:27:2: could not import golang.org/x/tools/go/gcexportdata (importing "golang.org/x/tools/go/gcexportdata": multiple Go packages in /Users/yoshiki.shibata/gocode/pkg/mod/golang.org/x/tools@v0.0.0-20191108193012-7d206e10da11/go/gcexportdata)
)
)
)

I guess the go2go doesn't handle +build ignore tag in main.go under golang.org/x/tools/go/gcexportdata.

@andybons
Copy link
Member

Duplicate of #39675

@andybons andybons marked this as a duplicate of #39675 Sep 29, 2020
@golang golang locked and limited conversation to collaborators Sep 29, 2021
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