-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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 -mod=readonly pkg@version uses -lang=go1.16 #54908
Comments
CC @bcmills |
This is a side-effect of #36876. Per https://go.dev/ref/mod#go-mod-file-go, @ldez, try running |
I ran the commands: $ go mod tidy -go=1.17
$ git st
## main...origin/main
M go.mod
M go.sum
$ git add .
$ git commit -m "go mod tidy -go=1.17"
[main 19d85af] go mod tidy -go=1.17
2 files changed, 25 insertions(+), 1 deletion(-)
$ go mod vendor
$ git add .
$ git commit -m "go mod vendor"
$ git push
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 16 threads
Compressing objects: 100% (17/17), done.
Writing objects: 100% (20/20), 13.20 KiB | 13.20 MiB/s, done.
Total 20 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 1 local object.
To github.com:ldez/go-install.git
5fca274..83193a3 main -> main $ docker run --rm -it golang:1.19 sh
# go install -mod=readonly github.com/ldez/go-install@83193a350e20b2a2cd1a73b16e48509f001ae926
go: downloading github.com/ldez/go-install v0.0.0-20220906213845-83193a350e20
go: downloading golang.org/x/exp v0.0.0-20220906200021-fcb1a314c389
# golang.org/x/exp/constraints
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:13:2: embedding interface element ~int|~int8|~int16|~int32|~int64 requires go1.18 or later (-lang was set to go1.16; check go.mod)
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:20:2: embedding interface element ~uint|~uint8|~uint16|~uint32|~uint64|~uintptr requires go1.18 or later (-lang was set to go1.16; check go.mod)
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:27:2: embedding interface element Signed|Unsigned requires go1.18 or later (-lang was set to go1.16; check go.mod)
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:34:2: embedding interface element ~float32|~float64 requires go1.18 or later (-lang was set to go1.16; check go.mod)
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:41:2: embedding interface element ~complex64|~complex128 requires go1.18 or later (-lang was set to go1.16; check go.mod)
pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:49:2: embedding interface element Integer|Float|~string requires go1.18 or later (-lang was set to go1.16; check go.mod)
# $ docker run --rm -it golang:1.19 sh
# git clone https://github.com/ldez/go-install.git
Cloning into 'go-install'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 28 (delta 4), reused 27 (delta 3), pack-reused 0
Receiving objects: 100% (28/28), 13.95 KiB | 3.49 MiB/s, done.
Resolving deltas: 100% (4/4), done.
# cd go-install
# go install -mod=readonly .
go: downloading golang.org/x/exp v0.0.0-20220906200021-fcb1a314c389
# github.com/ldez/go-install
embedding interface element ~[]string requires go1.18 or later (-lang was set to go1.17; check go.mod)
./main.go:11:20: implicit function instantiation requires go1.18 or later (-lang was set to go1.17; check go.mod)
# @bcmills The behavior is still the wrong one and now the problem is also here locally. Maybe I missed something but this cannot fix the problem. The dependency module (golang.org/x/exp) has the right Go version in the go.mod and my test module too (not after your suggestions indeed), and the local Go version is also right. Maybe my report was not clear about the expectations 🤔. |
@bcmills did I have to clarify something or provide more explanations? |
@ldez, the error message is different (and correct) after the update. In ldez/go-install@83193a3, the error is saying that it can't build In ldez/go-install@f93b9d8, the error is saying that it can't build If you want to actually use the generic API in
|
Maybe I don't understand something:
So I don't understand why the dependencies need to be vendored to be used with If I follow your explanation every application that uses a lib with generics must vendor the dependencies to be installed with |
Ahhh, I get it. Somehow I had missed the I'll have to look into this again. |
If it's not clear, I think this means no one can install gopls today, following the documented instructions. #55084 was called a duplicate of this, but I sorta think gopls should change deps to allow users to install today. |
gopls can be installed without the |
Change https://go.dev/cl/439855 mentions this issue: |
I am not using vim-go, I'm just following the command here: https://pkg.go.dev/golang.org/x/tools/gopls#readme-installation
…On Fri, Sep 30, 2022, at 12:38 AM, Sean Liao wrote:
gopls can be installed without the `-mod=readonly` flag, it should be vim-go that needs to use the correct command
—
Reply to this email directly, view it on GitHub <#54908 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAB7Y2BNMFKVXCO7CLLCSTWA2KHDANCNFSM6AAAAAAQGGH6KU>.
You are receiving this because you commented.Message ID: ***@***.***>
--
fREW Schmidt
https://blog.afoolishmanifesto.com
|
…vers When running go install --mod=readonly module@version. modfetch.GoSumFile was not set, so the checksumOk check that's done when checking whether we need to set the GoVersion from the go mod file was failing. Bypass the checksumOk check when there's no GoSumFile. For #54908 Change-Id: I56cf9d36a505b1223e6bf82a7d455746e2f09849 Reviewed-on: https://go-review.googlesource.com/c/go/+/439855 Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
This should be fixed by CL 439855 |
…vers When running go install --mod=readonly module@version. modfetch.GoSumFile was not set, so the checksumOk check that's done when checking whether we need to set the GoVersion from the go mod file was failing. Bypass the checksumOk check when there's no GoSumFile. For golang#54908 Change-Id: I56cf9d36a505b1223e6bf82a7d455746e2f09849 Reviewed-on: https://go-review.googlesource.com/c/go/+/439855 Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
Newest version of klauspost/compress uses go1.17. When compiling changes for adding zstd, the vendored klauspost/compress library failed to build because it expected go1.17, but go mod vendor defaults it to go1.16 instead, due to golang/go#54908 (comment) Signed-off-by: Michael Ho <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I created a repository to illustrate the problem.
ldez/go-install@5fca274
go install -mod=readonly .
andgo install -mod=readonly <module>
don't have the same behavior.The go version seems badly guessed.
The problem has been detected here golangci/golangci-lint#3177
What did you expect to see?
The same behavior locally and with a "remote" module.
What did you see instead?
The text was updated successfully, but these errors were encountered: