-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Fix ginkgo run with Golang 1.10 snap archive on Ubuntu 18.04 #505
Conversation
d0d8085
to
6babb36
Compare
Thanks @joestringer ! I am a bit concerned in removing the |
Hi @nodo! I can definitely appreciate that, Golang 1.10 is fairly new. For a bit more information, the maintainer of the Snap package described part of the issue here (some quotes below):
Some others on the same thread suggested that people should just move away from Perhaps a better alternative would be to be able to parameterize this option rather than hardcoding it? By default, it could always add |
Same issues occurs when Go modules introduced in Go1.11 is enabled. I used official Go compiler. |
@ueokande Perhaps then there's a better way that uses something like https://golang.org/pkg/runtime/#Version to detect and inject this at runtime. /cc @nodo thoughts? |
It would be better to use build constraints: To have different build args for Go <1.10 and >=1.10, create these two files:
// +build go1.10
var buildArgs = []string{"test", "-c"}
// +build !go1.10
var buildArgs = []string{"test", "-c", "-i"} and reference func (t *TestRunner) BuildArgs(path string) []string {
args := make([]string, len(buildArgs), len(buildArgs)+3)
copy(args, buildArgs)
args = append(args, "-o", path, t.Suite.Path)
...
} |
6babb36
to
39f23aa
Compare
Thanks @ymmt2005, I used your approach. |
fdd819d
to
92f66eb
Compare
Since Golang 1.10, this option should no longer be required: https://golang.org/doc/go1.10#build > The old advice to add the -i flag for speed, as in go build -i or go test -i, is no longer necessary: builds run just as fast without -i. For more details, see go help cache. Furthermore, it creates issues like the below when running ginkgo against a snap-installed version of Golang 1.10 on Ubuntu 18.04: $ ginkgo build Compiling test... Failed to compile test: go test runtime/cgo: open /snap/go/2130/pkg/linux_amd64/runtime/cgo.a: read-only file system
92f66eb
to
40e8e88
Compare
Thanks all, it makes sense to me! I will have a more close look later today. |
@nodo did you get a chance to take a look? |
Hey @joestringer - looks good to me I have a few doubts about the testing, but I cannot think about a better solution for now 😄 Thanks a lot for contributing! 💯 |
@nodo Thanks! I agree it's not the most elegant, but I couldn't think of something better. Fortunately I think if the testing changes significantly and this breaks, it should err on the side of "breaking when it shouldn't" rather than "hiding a breakage when it should break". |
Thanks! Just for your information, you can use |
Since Golang 1.10, this option should no longer be required:
https://golang.org/doc/go1.10#build
Furthermore, it creates issues like the below when running ginkgo
against a snap-installed version of Golang 1.10 on Ubuntu 18.04:
Fixes: #504