golang/go

cmd/go: diagnose packages listed in lexically-impossible modules in vendor/modules.txt

Open

#45,649 opened on Apr 20, 2021

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
GoCommandNeedsFixhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Does this issue reproduce with the latest release?

Yes

What did you do?

Moved from https://groups.google.com/u/1/g/golang-nuts/c/04MtZ96TPWo

I checked out the kubernetes project at tag v1.20.4. Then run "go list -deps -json ./... > json.txt" in the project root. In the produced json.txt file, I noticed that the module path for two packages look not right. The path of a package should be prefixed with its module path. But the two aren't. Bug?

The first:

{
    "Dir": "/home/myname/opensource/it-infrastructure/kubernetes/vendor/github.com/Azure/go-autorest/autorest/azure",
    "ImportPath": "github.com/Azure/go-autorest/autorest/azure",
    "Name": "azure",
    "Doc": "Package azure provides Azure-specific implementations used with AutoRest.",
    "Module": {
        "Path": "github.com/Azure/go-autorest/autorest/adal",
        "Replace": {
            "Path": "github.com/Azure/go-autorest/autorest/adal",
            "Version": "v0.9.5"
        }
    },
    ...

The second:

{
    "Dir": "/home/myname/opensource/it-infrastructure/kubernetes/vendor/cloud.google.com/go/compute/metadata",
    "ImportPath": "cloud.google.com/go/compute/metadata",
    "Name": "metadata",
    "Doc": "Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.",
    "Module": {
        "Path": "cloud.google.com/go/bigquery",
        "Replace": {
            "Path": "cloud.google.com/go/bigquery",
            "Version": "v1.4.0"
        },
        "Indirect": true
    },
    ...

What did you expect to see?

The path of a package should be prefixed with the path of its containing module.

What did you see instead?

The paths of two 2 packages are not prefixed with their module paths.

Contributor guide