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 find GOPATH package for function type parameter #40063

Closed
crawshaw opened this issue Jul 5, 2020 · 3 comments
Closed

cmd/go2go: cannot find GOPATH package for function type parameter #40063

crawshaw opened this issue Jul 5, 2020 · 3 comments
Assignees
Milestone

Comments

@crawshaw
Copy link
Contributor

@crawshaw crawshaw commented Jul 5, 2020

After using go get inet.af/netaddr to add the package to GOPATH, the go2go command can usually find it, as the following program compiles happily:

package main

import "inet.af/netaddr"

type S(type T) struct {
	V T
}

var s S(netaddr.IP)

func main() { }

However the following program:

package main

import (
        "fmt"
        "inet.af/netaddr"
)

func Print(type T)(v T) {
        fmt.Print(v)
}

func main() {
	var v netaddr.IP
        Print(v)
}

Fails to search GOPATH correctly:

go tool go2go run junk.go2
cannot find package "netaddr" in any of:
	/Users/crawshaw/repo/goroot/src/netaddr (from $GOROOT)
	/Users/crawshaw/go/src/netaddr (from $GOPATH)

Note the lack of inet.af in the error message.

@cagedmantis cagedmantis added this to the Unplanned milestone Jul 6, 2020
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jul 6, 2020

@ianlancetaylor ianlancetaylor self-assigned this Jul 6, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 7, 2020

Thanks. Fixed on dev.go2go branch.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 7, 2020

Change https://golang.org/cl/241217 mentions this issue: [dev.go2go] go/go2go: pass full path when importing Go 1 package

gopherbot pushed a commit that referenced this issue Jul 7, 2020
No test case because there is still no test harness for a complex
package heirarchy.

Fixes #40063

Change-Id: Iebe627dd7b2a3e967d437bee61c9d15c7a159fc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/241217
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.