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

Update Ginkgo's installation instruction to match Go 1.18+ #1026

Closed
thediveo opened this issue Aug 25, 2022 · 2 comments
Closed

Update Ginkgo's installation instruction to match Go 1.18+ #1026

thediveo opened this issue Aug 25, 2022 · 2 comments

Comments

@thediveo
Copy link
Contributor

At this time, Ginkgo's documentation instructs users to install Ginkgo using

go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo

Now I'm not sure if there are intended side effects of using mod=mod, but if there aren't any, then please update the instructions to follow Go 1.18+ practice:

go install github.com/onsi/ginkgo/v2/ginkgo@latest
@onsi
Copy link
Owner

onsi commented Aug 29, 2022

the change to add -mod=mod was added by @bdshroyer in this commit

The commit is labeled "Update docs to reflect Go v1.18 installation" and is from this PR: #950

which indicates that this is the issue:

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).

Ginkgo's go.mod now lists 1.18 so I suspect we can go back to just go install sans -mod=mod. I'll update the docs but feel free to chime in if you disagree @bdshroyer - you dug into this pretty deeply and I still find that go's various module related flags are opaque to me!

@onsi onsi closed this as completed in 6ad7138 Aug 29, 2022
@bdshroyer
Copy link
Contributor

bdshroyer commented Aug 29, 2022

I tried dropping the -mod=mod flag from my installation command in Github Actions and got the same errors that prompted #950. I think the current issue stems from the current backup defaults in the Go Build flags:

By default, if the [go version](https://go.dev/ref/mod#go-mod-file-go) in go.mod is 1.14 or higher and a vendor directory is present, the go command acts as if -mod=vendor were used. Otherwise, the go command acts as if -mod=readonly were used.

I'm not using any vendoring, so go install so unless you set the -mod flag Go currently defaults to readonly mode again and fails because it's barred from fetching the missing dependencies (I checked this by setting -mod=readonly and getting the same error, and then setting -mod=vendor and getting a completely different one that I hadn't seen).

If this is not a widely experienced bug I'll just keep setting -mod=mod for myself, but it looks like the conditions that led me to try it in the first place don't seem to have changed.

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

No branches or pull requests

3 participants