-
-
Notifications
You must be signed in to change notification settings - Fork 660
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
ginkgo generate fails in module #524
Comments
I’ve had that happen too. As you point out, we are in a tricky situation because people expect Gomega to work with Go modules, but Go modules (and their support packages) are not completely stable yet. I’ve heard several reports of issues with Go 1.11. I expect the stability will improve rapidly. If you (or anyone else) fancy submitting a PR that maintains backwards compatibility, then I’d gladly review it |
In the meantime, you can symlink your project and run
EDIT: This suggestion is targeted for macOS users; adapt as necessary. |
@blgm , as you mentioned, their new modules support packages (namely golang.org/x/tools/go/packages) are still not stable. According to the linked issue, the On the plus side, the That said, I would advise against half-baked workaround solutions for now, and instead wait for |
Can we use this as a solution? // ModulePath returns the module path from the gomod file text.
// If it cannot find a module path, it returns an empty string.
// It is tolerant of unrelated problems in the go.mod file.
func ModulePath(mod []byte) string {
for len(mod) > 0 {
line := mod
... https://github.com/golang/go/blob/master/src/cmd/go/internal/modfile/read.go#L837 I mean, this is how go internally read the module path from |
Typo fix This changes how `generate` command looks for import path. Now it will try to find `go.mod` file and determine import path from there first, and will fallback to old way otherwise. [Fixes onsi#524]
It seems that running
ginkgo generate
inside a go module, as per go 1.11, somewhere outsideGOPATH
results in a broken test skeleton.Example:
The problem likely stems from the usage of
ImportDir
which does not work with go modules:ginkgo/ginkgo/bootstrap_command.go
Line 106 in 000d317
This has been described here:
golang/go#26504
A workaround is to use the golang.org/x/tools/go/packages package, however it is not stable yet.
The text was updated successfully, but these errors were encountered: