You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In module mode, non-main packages have no install path: built packages are stored only in the build cache. In module mode, go install for a non-main package only ensures that the build cache is up to date; it does not install the library elsewhere.
According to that interpretation, we should not report a library as Stale in module mode if it is already up to date in the build cache. Today, we always report libraries as stale:
$ go version
go version devel go1.17-a9bb38222 Thu Jun 24 03:45:33 2021 +0000 linux/amd64
$ go mod init example.com/m
go: creating new go.mod: module example.com/m
$ go get -d golang.org/x/tools/imports
go: downloading golang.org/x/tools v0.1.4
go: downloading golang.org/x/mod v0.4.2
go: downloading golang.org/x/sys v0.0.0-20210510120138-977fb7262007
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go get: added golang.org/x/mod v0.4.2
go get: added golang.org/x/sys v0.0.0-20210510120138-977fb7262007
go get: added golang.org/x/tools v0.1.4
go get: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
$ go list -f '{{if .Stale}}{{.StaleReason}}{{end}}' golang.org/x/tools/imports
stale dependency: golang.org/x/tools/internal/event/label
$ go install golang.org/x/tools/imports
$ go list -f '{{if .Stale}}{{.StaleReason}}{{end}}' golang.org/x/tools/imports
not installed but available in build cache
$ go install golang.org/x/tools/imports
$ go list -f '{{if .Stale}}{{.StaleReason}}{{end}}' golang.org/x/tools/imports
not installed but available in build cache
This appears to have been fixed incidentally by (or in association with) #47257.
$ go version
go version devel go1.20-888047c310 Sun Dec 11 16:34:38 2022 +0000 linux/amd64
$ go mod init example
go: creating new go.mod: module example
$ go get -d golang.org/x/tools/imports
go: downloading golang.org/x/tools v0.4.0
go: downloading golang.org/x/mod v0.7.0
go: downloading golang.org/x/sys v0.3.0
go: added golang.org/x/mod v0.7.0
go: added golang.org/x/sys v0.3.0
go: added golang.org/x/tools v0.4.0
$ go list -f '{{if .Stale}}{{.StaleReason}}{{end}}' golang.org/x/tools/imports
stale dependency: internal/goarch
$ go install golang.org/x/tools/imports
$ go list -f '{{if .Stale}}{{.StaleReason}}{{end}}' golang.org/x/tools/imports
In module mode, non-
main
packages have no install path: built packages are stored only in the build cache. In module mode,go install
for a non-main package only ensures that the build cache is up to date; it does not install the library elsewhere.According to https://tip.golang.org/cmd/go/#hdr-List_packages_or_modules, the
Stale
field means:According to that interpretation, we should not report a library as
Stale
in module mode if it is already up to date in the build cache. Today, we always report libraries as stale:This came to my attention via https://stackoverflow.com/q/64462190.
CC @jayconrod @matloob
The text was updated successfully, but these errors were encountered: