Skip to content

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

Closed
@YoshikiShibata

Description

@YoshikiShibata

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/[email protected]/tools.go:27:4: could not import golang.org/x/lint/golint (/Users/yoshiki.shibata/gocode/pkg/mod/golang.org/x/[email protected]/golint/golint.go:19:2: could not import golang.org/x/lint (/Users/yoshiki.shibata/gocode/pkg/mod/golang.org/x/[email protected]/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/[email protected]/go/gcexportdata)
)
)
)

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

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