Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 #59281

Closed
kylechadha opened this issue Mar 27, 2023 · 10 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@kylechadha
Copy link

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

$ go version
go version go1.20.2 darwin/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="/Users/kychadha/Library/Caches/go-build"
GOENV="/Users/kychadha/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/kychadha/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kychadha/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1c/6gy6bjfj3ml92s6ttk7tgjsm0000gq/T/go-build2823959463=/tmp/go-build -gno-record-gcc-switches -fno-common"

Note: The above was generated after I downgraded to go1.19.7 which doesn't have the issue described below

What did you do?

➜  ~ go install golang.org/x/tools/gopls@latest

What did you expect to see?

➜  ~ go install golang.org/x/tools/gopls@latest
go: downloading golang.org/x/tools v0.3.1-0.20221213193459-ca17b2c27ca8
go: downloading honnef.co/go/tools v0.3.3
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading mvdan.cc/xurls/v2 v2.4.0
go: downloading golang.org/x/text v0.4.0
go: downloading golang.org/x/exp/typeparams v0.0.0-20221031165847-c99f073a8326
go: downloading golang.org/x/sys v0.2.0
go: downloading golang.org/x/vuln v0.0.0-20221109205719-3af8368ee4fe
go: downloading golang.org/x/exp v0.0.0-20221031165847-c99f073a8326

What did you see instead?

➜  ~ go install golang.org/x/tools/gopls@latest
go: golang.org/x/tools/gopls@latest: module golang.org/x/tools/gopls@latest found (v0.11.0), but does not contain package golang.org/x/tools/gopls

Downgraded to 1.19 and things work again. Was setting up a new laptop on mac 13.2.1 and VS code alerted me it couldn't install the required go tools. Attemping to install via terminal resulted in the same error message.

@kylechadha kylechadha changed the title affected/package: go install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 go install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 Mar 27, 2023
@kylechadha
Copy link
Author

Could be dup of #58116

@seankhliao seankhliao changed the title go install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 cmd/go install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 Mar 28, 2023
@seankhliao seankhliao changed the title cmd/go install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 cmd/go: install: module found, but does not contain package on 1.20.2, works fine on 1.19.7 Mar 28, 2023
@seankhliao
Copy link
Member

What's in :

  • /Users/kychadha/go/pkg/mod/golang.org/x/tools/gopls@v0.11.0/go.mod
  • /Users/kychadha/go/pkg/mod/cache/download/golang.org/x/tools/gopls/@v/v0.11.0.mod
  • /Users/kychadha/go/pkg/mod/cache/download/golang.org/x/tools/gopls/@v/v0.11.0.info

does it reproduce if you start with an empty module cache?
(export GOMODCACHE=$(mktemp -d -t gomodcache) , then try installing again?)

@mknyszek mknyszek added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Apr 3, 2023
@mknyszek mknyszek added this to the Backlog milestone Apr 3, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Apr 3, 2023

CC @bcmills

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 3, 2023
@bcmills
Copy link
Contributor

bcmills commented Apr 3, 2023

Could be corrupted module index data too. What happens if you set GODEBUG=goindex=0 in the environment prior to running the command?

(CC @matloob)

@flowchartsman
Copy link

flowchartsman commented Apr 21, 2023

CC @bcmills
I was having this same problem after building Go from source (after I overcame #59026 that is). Here are the results. Original contents should be in the edit history of this comment, if it matters.

$ go install -v golang.org/x/tools/gopls@v0.11.0
go: golang.org/x/tools/gopls@v0.11.0: module golang.org/x/tools/gopls@v0.11.0 found, but does not contain package golang.org/x/tools/gopls

$ GODEBUG=goindex=0 go install -v golang.org/x/tools/gopls@v0.11.0
go: downloading golang.org/x/tools v0.3.1-0.20221213193459-ca17b2c27ca8
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading honnef.co/go/tools v0.3.3
go: downloading mvdan.cc/gofumpt v0.4.0
go: downloading mvdan.cc/xurls/v2 v2.4.0
go: downloading golang.org/x/mod v0.7.0
go: downloading golang.org/x/text v0.4.0
go: downloading github.com/google/go-cmp v0.5.9
go: downloading golang.org/x/exp/typeparams v0.0.0-20221031165847-c99f073a8326
go: downloading golang.org/x/sys v0.2.0
go: downloading golang.org/x/sync v0.1.0
go: downloading golang.org/x/vuln v0.0.0-20221109205719-3af8368ee4fe
go: downloading golang.org/x/exp v0.0.0-20221031165847-c99f073a8326
crypto/internal/alias
internal/types/errors
internal/nettrace
container/list
crypto/subtle
*****SNIP*****
golang.org/x/tools/gopls/internal/lsp/work
golang.org/x/tools/gopls/internal/hooks
golang.org/x/tools/gopls/internal/lsp/template
golang.org/x/tools/gopls/internal/lsp/source/completion
golang.org/x/tools/gopls/internal/lsp/mod
golang.org/x/tools/gopls/internal/lsp/cache
golang.org/x/tools/gopls/internal/lsp/debug
golang.org/x/tools/gopls/internal/lsp
golang.org/x/tools/gopls/internal/lsp/lsprpc
golang.org/x/tools/gopls

@bcmills
Copy link
Contributor

bcmills commented Apr 27, 2023

(CC @matloob)
@julieqiu ran into this today, and might be able to provide us with a build cache and module cache for debugging.

@bcmills
Copy link
Contributor

bcmills commented Apr 27, 2023

Current theory is filesystem corruption in the cached index data. Maybe we should add checksumming. 🤔

@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@kylechadha
Copy link
Author

kylechadha commented May 3, 2023

@seankhliao @bcmills
Apologies for the delay, I haven't been able to recreate this issue since downgrading to go 1.19. I manually deleted the module cache at least once before attempting to install, but didn't try either of your recommendations around GOMODCACHE and GODEBUG. If I see the issue again I'll give those a go and report back.

@kylechadha
Copy link
Author

@seankhliao @bcmills

Upgraded to 1.20 and ran into this again today.

➜  rgn-app git:(main) go install github.com/spf13/cobra/cobra 
no required module provides package github.com/spf13/cobra/cobra; to add it:
        go get github.com/spf13/cobra/cobra
➜  rgn-app git:(main) go get github.com/spf13/cobra/cobra
go: downloading github.com/spf13/cobra v1.7.0
go: module github.com/spf13/cobra@upgrade found (v1.7.0), but does not contain package github.com/spf13/cobra/cobra
➜  rgn-app git:(main) GODEBUG=goindex=0 go get -u github.com/spf13/cobra/cobra
go: module github.com/spf13/cobra@upgrade found (v1.7.0), but does not contain package github.com/spf13/cobra/cobra
➜  rgn-app git:(main) GOMODCACHE=$(mktemp -d -t gomodcache)  go get -u github.com/spf13/cobra/cobra
go: downloading github.com/spf13/cobra v1.7.0
go: module github.com/spf13/cobra@upgrade found (v1.7.0), but does not contain package github.com/spf13/cobra/cobra
➜  @v cat v1.7.0.info
{"Version":"v1.7.0","Time":"2023-03-22T22:41:51Z","Origin":{"VCS":"git","URL":"https://github.com/spf13/cobra","Ref":"refs/tags/v1.7.0","Hash":"4dd4b25de38418174a6e859e8a32eaccca32dccc"}}%
➜  @v cat v1.7.0.mod
module github.com/spf13/cobra

go 1.15

require (
	github.com/cpuguy83/go-md2man/v2 v2.0.2
	github.com/inconshreveable/mousetrap v1.1.0
	github.com/spf13/pflag v1.0.5
	gopkg.in/yaml.v3 v3.0.1
)
➜  @v pwd
/Users/kychadha/go/pkg/mod/cache/download/github.com/spf13/cobra/@v

Tried with go1.19 install as well, same result

➜  rgn-app git:(main) GOMODCACHE=$(mktemp -d -t gomodcache) go1.19 get github.com/spf13/cobra/cobra
go: downloading github.com/spf13/cobra v1.7.0
go: module github.com/spf13/cobra@upgrade found (v1.7.0), but does not contain package github.com/spf13/cobra/cobra
➜  rgn-app git:(main) GODEBUG=goindex=0 go1.19 get github.com/spf13/cobra/cobra
go: module github.com/spf13/cobra@upgrade found (v1.7.0), but does not contain package github.com/spf13/cobra/cobra

However, after installing 1.19 with the package installer, there are no isues:

➜  rgn-app git:(main) go get -u github.com/spf13/cobra@latest
go: downloading github.com/inconshreveable/mousetrap v1.1.0
go: added github.com/inconshreveable/mousetrap v1.1.0
go: added github.com/spf13/cobra v1.7.0
go: added github.com/spf13/pflag v1.0.5
➜  rgn-app git:(main) ✗ go version
go version go1.19.9 darwin/amd64

@golang golang locked and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants