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

Go v1.18 breaks installation procedure in docs #950

Closed
bdshroyer opened this issue Mar 21, 2022 · 3 comments · Fixed by #951
Closed

Go v1.18 breaks installation procedure in docs #950

bdshroyer opened this issue Mar 21, 2022 · 3 comments · Fixed by #951

Comments

@bdshroyer
Copy link
Contributor

Hello all,

I upgraded to Go v1.18 over the weekend, and the installation instructions under Getting Started -> Installing Ginkgo no longer work.

The following is the output I receive when attempting to run go get github.com/onsi/ginkgo/v2/ginkgo in the golang:latest container. I have achieved similar results in a Github Action:

# go install github.com/onsi/ginkgo/v2/ginkgo
/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.3/ginkgo/generators/bootstrap_command.go:9:2: missing go.sum entry for module providing package github.com/go-task/slim-sprig (imported by github.com/onsi/ginkgo/v2/ginkgo/generators); to add:
	go get github.com/onsi/ginkgo/v2/ginkgo/generators@v2.1.3
/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.3/ginkgo/internal/profiles_and_reports.go:12:2: missing go.sum entry for module providing package github.com/google/pprof/profile (imported by github.com/onsi/ginkgo/v2/ginkgo/internal); to add:
	go get github.com/onsi/ginkgo/v2/ginkgo/internal@v2.1.3
/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.3/ginkgo/labels/labels_command.go:15:2: missing go.sum entry for module providing package golang.org/x/tools/go/ast/inspector (imported by github.com/onsi/ginkgo/v2/ginkgo/labels); to add:
	go get github.com/onsi/ginkgo/v2/ginkgo/labels@v2.1.3

This matches the Go dev blog's notes around the deprecation of go get as an installer. That said, replacing get with install doesn't work either.

The fix I found is to double up the get and install commands like so:

go get -d github.com/onsi/ginkgo/v2/ginkgo && go install github.com/onsi/ginkgo/v2/ginkgo

Based on my own efforts, installing GInkgo this way doesn't break Go v1.17, but I didn't test on earlier versions. I've also been unable to replicate a need to explicitly invoke go get github.com/onsi/gomega/....

I'm happy to PR the change into the docs, but I didn't know if it was going to be part of a larger update in the works.

@bdshroyer bdshroyer changed the title Ginkgo v1.18 breaks installation procedure in docs Go v1.18 breaks installation procedure in docs Mar 21, 2022
@onsi
Copy link
Owner

onsi commented Mar 21, 2022

hey @bdshroyer - there are no bigger plans at the moment, no. I don't think I understand why go install is failing since the go docs seem to indicate that that should work. but if go get followed by go install works then that's what we need to do I suppose. please do submit a PR for the docs.

@bdshroyer
Copy link
Contributor Author

bdshroyer commented Mar 21, 2022

I found a little bit more about go install's behavior in the build command flags. Specifically, the -mod flag is set to readonly by default when the Go version in go.mod is below 1.14 (GInkgo's is 1.12). The readonly mode raises the errors we see above when it can't find a module in the cache--it was just never an issue before because all the modules were being downloaded in advance by the go get installation process.

When you run go get or go get -d before running install, or if you install using go get on Go 1.17, you can see the modules with missing go sums getting downloaded (as well as ginkgo v1.16.5 for some reason):

| go: downloading github.com/onsi/ginkgo v1.16.5
| go: downloading golang.org/x/tools v0.1.9
| go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
| go: downloading github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38

Similarly, if you run go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo you can see it downloading the missing modules as well, and ginkgo installs successfully.

Given all this, I'll probably put go install -mod=mod in my PR, since one command is generally preferable to two.

bdshroyer added a commit to bdshroyer/ginkgo that referenced this issue Mar 21, 2022
bdshroyer added a commit to bdshroyer/ginkgo that referenced this issue Mar 21, 2022
@onsi
Copy link
Owner

onsi commented Mar 23, 2022

💯 thanks for digging into it @bdshroyer !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants