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/go: list import map incorrectly has test variant #26880

Closed
suzmue opened this issue Aug 8, 2018 · 3 comments
Closed

cmd/go: list import map incorrectly has test variant #26880

suzmue opened this issue Aug 8, 2018 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@suzmue
Copy link
Contributor

suzmue commented Aug 8, 2018

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

go version devel +e7bce08493 Wed Aug 8 16:54:21 2018 +0000 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

What did you do?

go list -json -test -- a b

a/a.go: package a; import _ "b"
b/b.go: package b
b/b_test.go: package b
b/bx_test.go: package b_test; import _ "a"

What did you expect to see?

I expected the Imports of package a to be "b" not the test variant "b [b.test]

{
        "Dir": "/Users/suzmue/go/src/a",
        "ImportPath": "a",
        "Name": "a",
        "Target": "/Users/suzmue/go/pkg/darwin_amd64/a.a",
        "Root": "/Users/suzmue/go",
        "Stale": true,
        "StaleReason": "stale dependency: b",
        "GoFiles": [
                "a.go"
        ],
        "Imports": [
                "b"
        ],
        "Deps": [
                "b"
        ]
}
{
        "Dir": "/Users/suzmue/go/src/b",
        "ImportPath": "b [b.test]",
        "Name": "b",
        "Root": "/Users/suzmue/go",
        "ForTest": "b",
        "Stale": true,
        "StaleReason": "build ID mismatch",
        "GoFiles": [
                "b.go",
                "b_test.go"
        ],
        "TestGoFiles": [
                "b_test.go"
        ],
        "XTestGoFiles": [
                "bx_test.go"
        ],
        "XTestImports": [
                "a",
                "b"
        ]
}
...

What did you see instead?

{
        "Dir": "/Users/suzmue/go/src/a",
        "ImportPath": "a",
        "Name": "a",
        "Target": "/Users/suzmue/go/pkg/darwin_amd64/a.a",
        "Root": "/Users/suzmue/go",
        "Stale": true,
        "StaleReason": "stale dependency: b",
        "GoFiles": [
                "a.go"
        ],
        "Imports": [
                "b [b.test]"
        ],
        "ImportMap": {
                "b": "b [b.test]"
        },
        "Deps": [
                "b"
        ]
}
{
        "Dir": "/Users/suzmue/go/src/b",
        "ImportPath": "b [b.test]",
        "Name": "b",
        "Root": "/Users/suzmue/go",
        "ForTest": "b",
        "Stale": true,
        "StaleReason": "build ID mismatch",
        "GoFiles": [
                "b.go",
                "b_test.go"
        ],
        "TestGoFiles": [
                "b_test.go"
        ],
        "XTestGoFiles": [
                "bx_test.go"
        ],
        "XTestImports": [
                "a",
                "b"
        ]
}
...

cc @bcmills

@suzmue suzmue changed the title cmd/go: cmd/go: list import map incorrectly has test variant Aug 8, 2018
@suzmue
Copy link
Contributor Author

suzmue commented Aug 8, 2018

I believe this is the underlying cause of #26847

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 8, 2018
@bcmills bcmills added this to the Go1.11 milestone Aug 8, 2018
@bcmills
Copy link
Contributor

bcmills commented Aug 8, 2018

CC: @rsc

@gopherbot
Copy link

Change https://golang.org/cl/128836 mentions this issue: cmd/go: list -test reports the correct import path

@golang golang locked and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants