Skip to content

cmd/go: go list with -reuse fails to invalidate @latest when the previous result was an error #61415

@bcmills

Description

@bcmills

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

$ go version
go version devel go1.21-18e17e2c Thu Jun 29 23:06:46 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/bcmills/.cache/go-build'
GOENV='/usr/local/google/home/bcmills/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/tmp/tmp.n0kPM4RTS6/.gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/bcmills/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/google/home/bcmills/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.21-18e17e2c Thu Jun 29 23:06:46 2023 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2124346309=/tmp/go-build -gno-record-gcc-switches'

What did you do?

$ cat > reuse.json
{
        "Path": "go.dkinom.dev/baseconv/characters",
        "Version": "v0.0.0-20230716190303-357f22feb6b8",
        "Query": "latest",
        "Origin": {
                "VCS": "git",
                "URL": "https://github.com/godsfood/baseconv",
                "Subdir": "characters",
                "Hash": "357f22feb6b8d456266ad5ce2aa31fd042d44de2"
        }
}

$ GOPROXY=direct go list -m -retracted -e -x -v -json=Version,Versions,Error,Path,Query,Origin,Reuse --versions -reuse=reuse.json -- go.dkinom.dev/baseconv/characters@latest

What did you expect to see?

$ GOPROXY=direct go list -m -retracted -e -x -v -json=Version,Versions,Error,Path,Query,Origin,Reuse --versions -- go.dkinom.dev/baseconv/characters@latest
# get https://go.dkinom.dev/baseconv/characters?go-get=1
# get https://go.dkinom.dev/baseconv/characters?go-get=1: 200 OK (0.081s)
get "go.dkinom.dev/baseconv/characters": found meta tag vcs.metaImport{Prefix:"go.dkinom.dev/baseconv", VCS:"git", RepoRoot:"https://github.com/godsfood/baseconv"} at //go.dkinom.dev/baseconv/characters?go-get=1
get "go.dkinom.dev/baseconv/characters": verifying non-authoritative meta tag
# get https://go.dkinom.dev/baseconv?go-get=1
# get https://go.dkinom.dev/baseconv?go-get=1: 200 OK (0.040s)
mkdir -p /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs # git3 https://github.com/godsfood/baseconv
# lock /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949.lock
# /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949 for git3 https://github.com/godsfood/baseconv
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git ls-remote -q origin
0.181s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git ls-remote -q origin
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 3bd85f839063b2b23ccab1be6cd4c87940d2cda1 --
0.008s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 3bd85f839063b2b23ccab1be6cd4c87940d2cda1 --
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git for-each-ref --format %(refname) refs/tags --merged 3bd85f839063b2b23ccab1be6cd4c87940d2cda1
0.004s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git for-each-ref --format %(refname) refs/tags --merged 3bd85f839063b2b23ccab1be6cd4c87940d2cda1
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 3bd85f839063 --
0.007s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 3bd85f839063 --
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git cat-file blob 3bd85f839063b2b23ccab1be6cd4c87940d2cda1:characters/go.mod
0.004s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git cat-file blob 3bd85f839063b2b23ccab1be6cd4c87940d2cda1:characters/go.mod
{
        "Path": "go.dkinom.dev/baseconv/characters",
        "Version": "v0.0.0-20230718102946-3bd85f839063",
        "Query": "latest",
        "Origin": {
                "VCS": "git",
                "URL": "https://github.com/godsfood/baseconv",
                "Subdir": "characters",
                "TagPrefix": "characters/",
                "TagSum": "t1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
                "Ref": "HEAD",
                "Hash": "3bd85f839063b2b23ccab1be6cd4c87940d2cda1"
        }
}

What did you see instead?

$ GOPROXY=direct go list -m -retracted -e -x -v -json=Version,Versions,Error,Path,Query,Origin,Reuse --versions -reuse=reuse.json -- go.dkinom.dev/baseconv/characters@latest
# get https://go.dkinom.dev/baseconv/characters?go-get=1
# get https://go.dkinom.dev/baseconv/characters?go-get=1: 200 OK (0.073s)
get "go.dkinom.dev/baseconv/characters": found meta tag vcs.metaImport{Prefix:"go.dkinom.dev/baseconv", VCS:"git", RepoRoot:"https://github.com/godsfood/baseconv"} at //go.dkinom.dev/baseconv/characters?go-get=1
get "go.dkinom.dev/baseconv/characters": verifying non-authoritative meta tag
# get https://go.dkinom.dev/baseconv?go-get=1
# get https://go.dkinom.dev/baseconv?go-get=1: 200 OK (0.026s)
mkdir -p /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs # git3 https://github.com/godsfood/baseconv
# lock /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949.lock
# /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949 for git3 https://github.com/godsfood/baseconv
cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git ls-remote -q origin
0.198s # cd /tmp/tmp.n0kPM4RTS6/.gopath/pkg/mod/cache/vcs/7b8cca26b47a7a5711e2adacad45276205192931f68c3f0673d760c865d00949; git ls-remote -q origin
{
        "Path": "go.dkinom.dev/baseconv/characters",
        "Version": "v0.0.0-20230716190303-357f22feb6b8",
        "Query": "latest",
        "Origin": {
                "VCS": "git",
                "URL": "https://github.com/godsfood/baseconv",
                "Subdir": "characters",
                "Hash": "357f22feb6b8d456266ad5ce2aa31fd042d44de2"
        },
        "Reuse": true
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions