golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.07k stars 17.68k forks source link

cmd/go: `list -m -u all` does not output deprecation or retraction notices if dependency is replaced #60210

Open goto1134 opened 1 year ago

goto1134 commented 1 year ago

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

$ go version
go version go1.20.4 darwin/arm64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOVERSION="go1.20.4"

What did you do?

Using the following go.mod file run go list -json -m -u all

module testt

go 1.20

require (
    github.com/arungudelli/Retract-Go-Module-Versions v0.2.0
)

replace github.com/arungudelli/Retract-Go-Module-Versions => github.com/golang/protobuf v1.5.0

What did you expect to see?

A JSON with the Retracted field.

...
{
        "Path": "github.com/arungudelli/Retract-Go-Module-Versions",
        "Version": "v0.2.0",
        "Time": "2021-02-13T09:07:04Z",
        "Replace": {
                "Path": "github.com/golang/protobuf",
                "Version": "v1.5.0",
                "Time": "2021-03-18T00:15:31Z",
                "Update": {
                        "Path": "github.com/golang/protobuf",
                        "Version": "v1.5.3",
                        "Time": "2021-09-16T00:37:10Z"
                },
                "Dir": ".../go/pkg/mod/github.com/golang/protobuf@v1.5.0",
                "GoMod": ".../go/pkg/mod/cache/download/github.com/golang/protobuf/@v/v1.5.0.mod",
                "GoVersion": "1.9",
                "Deprecated": "Use the \"google.golang.org/protobuf\" module instead."
        },
        "Update": {
                "Path": "github.com/arungudelli/Retract-Go-Module-Versions",
                "Version": "v0.3.1",
                "Time": "2021-02-13T09:39:05Z"
        },
        "Dir": ".../go/pkg/mod/github.com/arungudelli/!retract-!go-!module-!versions@v0.2.0",
        "GoMod": ".../go/pkg/mod/cache/download/github.com/arungudelli/!retract-!go-!module-!versions/@v/v0.2.0.mod",
        "GoVersion": "1.16",
        "Retracted": [
                "Mistake happened in the version DO NOT USE"
        ]
}

What did you see instead?

A JSON without the Retracted field.

...
{
        "Path": "github.com/arungudelli/Retract-Go-Module-Versions",
        "Version": "v0.2.0",
        "Replace": {
                "Path": "github.com/golang/protobuf",
                "Version": "v1.5.0",
                "Time": "2021-03-18T00:15:31Z",
                "Update": {
                        "Path": "github.com/golang/protobuf",
                        "Version": "v1.5.3",
                        "Time": "2021-09-16T00:37:10Z"
                },
                "Dir": ".../go/pkg/mod/github.com/golang/protobuf@v1.5.0",
                "GoMod": ".../go/pkg/mod/cache/download/github.com/golang/protobuf/@v/v1.5.0.mod",
                "GoVersion": "1.9",
                "Deprecated": "Use the \"google.golang.org/protobuf\" module instead."
        },
        "Update": {
                "Path": "github.com/arungudelli/Retract-Go-Module-Versions",
                "Version": "v0.3.1",
                "Time": "2021-02-13T09:39:05Z"
        },
        "Dir": ".../go/pkg/mod/github.com/golang/protobuf@v1.5.0",
        "GoMod": ".../go/pkg/mod/cache/download/github.com/golang/protobuf/@v/v1.5.0.mod",
        "GoVersion": "1.9"
}

Why is it important?

Dependent packages will get the required dependency, not the replacement. As a developer, I want to be notified if the declared dependency is retracted or deprecated.

seankhliao commented 1 year ago

cc @bcmills