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: translation considers package x_test to be part of package x #39801

Closed
firelizzard18 opened this issue Jun 24, 2020 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@firelizzard18
Copy link
Contributor

Go 1 allows package a_test to reference package b and package b to reference package a. go2go considers this to be an import cycle.

go test will succeed with the following, but go tool go2go test will issue a circular import error (if .go is changed to .go2)

--- a/a.go ---
package a

func F() {}

--- b/b.go
package b

import "./a"

func F() { a.F() }

--- b/b_test.go ---
package b_test

import "testing"
import "./b"

func Test(*testing.T) { b.F() }

What version of Go are you using (go version)?

$ go version
go version devel +da7932368b Mon Jun 22 19:06:44 2020 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

  • git clone https://gitlab.com/firelizzard/go-iter
  • cd go-iter/issues/i4
  • go tool go2go build

What did you expect to see?

A successful build

What did you see instead?

type checking failed for i4_test
i4_test.go2:6:2: could not import gitlab.com/firelizzard/go-iter/issues/i4/a (type checking failed for a
/tmp/go2go529617879/src/gitlab.com/firelizzard/go-iter/issues/i4/a/a.go2:3:8: could not import gitlab.com/firelizzard/go-iter/issues/i4 (type checking failed for i4_test
/tmp/go2go529617879/src/gitlab.com/firelizzard/go-iter/issues/i4/i4_test.go2:6:2: could not import gitlab.com/firelizzard/go-iter/issues/i4/a (circular import when processing "gitlab.com/firelizzard/go-iter/issues/i4/a")
)
)
@firelizzard18 firelizzard18 changed the title cmd/go2go: Translation considers package x to be part of package x_test cmd/go2go: Translation considers package x_test to be part of package x Jun 24, 2020
@cagedmantis cagedmantis changed the title cmd/go2go: Translation considers package x_test to be part of package x cmd/go2go: translation considers package x_test to be part of package x Jun 24, 2020
@cagedmantis cagedmantis added this to the Unreleased milestone Jun 24, 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 Jun 24, 2020
@ianlancetaylor
Copy link
Contributor

Thanks. Yes, this is a known deficiency in the translation tool. I'll leave this issue open but I have no plans to fix this. If anyone else wants to tackle it, that would be fine.

@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