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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@crawshaw
Copy link
Member

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 cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 6, 2020
@cagedmantis
Copy link
Contributor

/cc @ianlancetaylor @griesemer

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

Thanks. Fixed on dev.go2go branch.

@gopherbot
Copy link

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>
@golang golang locked and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants