Skip to content

cmd/go: go list should not add a dependency to go.mod #28014

@hyangah

Description

@hyangah

This is probably a duplicate of #27643. The thread got too long and I want to bring the attention to the go list command by filling this as a separate issue.

I was in a branch with a v2 module and this doesn't have a dependency on v0 or v1.

$ go list github.com/hyangah/foo/v2
github.com/hyangah/foo/v2 
$ cat go.mod
module github.com/hyangah/foo/v2

I queried the package in v1 by accident and found the go.mod was updated.

$ go list github.com/hyangah/foo
github.com/hyangah/foo
$ cat go.mod
module github.com/hyangah/foo/v2

require github.com/hyangah/foo v1.0.1 // indirect

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions