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: modules support #40061

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

cmd/go2go: modules support #40061

crawshaw opened this issue Jul 5, 2020 · 5 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

(Edited to use a clearer example)

The documentation for go2go says "If not found in GO2PATH, imports will be looked up in the usual way." which hints the tool is GOPATH-only. That seems to be so:

go mod init foo
go get inet.af/netaddr
go tool go2go build
foo.go2:1: cannot find package "inet.af/netaddr" in any of:
	/Users/crawshaw/repo/goroot/src/inet.af/netaddr (from $GOROOT)
	/var/folders/sc/v9m_1yq142s1yss76xc0xlqw0000gn/T/go2go017169277/src/inet.af/netaddr (from $GOPATH)
	/Users/crawshaw/go/src/inet.af/netaddr
/Users/crawshaw/repo/goroot/bin/go [build] failed: exit status 1

With foo.go2:

package main

import "inet.af/netaddr"

type S(type T) struct {
	V T
}

var s S(netaddr.IP)

func main() { }

I doubt this is worth a major effort. If it's easy though, it would be useful for experiments converting a few leaf packages in a large project.

(I have a package in tailscale's corp repository that gets easier to read and more efficient with type parameters that I would happily convert to go2go now, but it requires lifting a lot of the build system back into GOPATH.)

@ALTree ALTree 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
@ALTree ALTree added this to the Unreleased milestone Jul 6, 2020
@ianlancetaylor
Copy link
Contributor

If someone wants to add module support to the tool, that would be fine with me. It's not something that I am going to work on myself. I don't think it would be easy, but perhaps I am mistaken.

@AchoArnold
Copy link

I'm curious, Is there a workaround for this other than having to download the dependency using git?

Using the example above, I can solve it by manually downloading the package in the /Users/crawshaw/go/src/inet.af/netaddr directory. Is there a better way of making this work?

@ianlancetaylor
Copy link
Contributor

Manual downloads are the only workaround. Sorry. It's an experimental tool for trying out the generics design, it's not intended for production use.

@AchoArnold
Copy link

Thanks @ianlancetaylor

@ALTree
Copy link
Member

ALTree commented Jul 30, 2021

The go2go branch is no longer maintained:

This branch was published in 2020 and is no longer being maintained. The generics proposal has been accepted and development is now focused on implementing the proposal in the ordinary Go tools.

So I think we can close here.

@ALTree ALTree closed this as completed Jul 30, 2021
@golang golang locked and limited conversation to collaborators Jul 30, 2022
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

5 participants