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: support go build -o /dev/null #4851
Labels
Milestone
Comments
This issue was closed as Fixed, but it was not fixed. It is causing issues with tools that want to check if a file can be built successfully, without actually creating a binary. flychecker for example is a very popular emacs tool that does syntax checking for many languages. Its support for go uses the output of "go build" to figure out where syntax errors exist and highlight them. flycheck/flycheck#107 http://flycheck.github.io/ Also, I don't think it is "too magic". The concept of a null device is pretty standard, and even supported in go as const os.DevNull (/dev/null for *nix, NUL for windows, etc). The fix seems pretty straightforward. Only copy final target file if destination is not os.DevNull. i.e. end (*builder).install method with: if a.target == os.DevNull { return nil } return b.copyFile(a, a.target, a1.target, perm) |
i suspect using "go build" just to test syntax is not correct as it invokes the whole toolchain. why not just let the go tool create a binary in $TMPDIR? and then delete it? (please note that the Go tool is already creating the final binary, so i believe we can't gain anything by output to /dev/null) |
re: "just testing syntax", saying that it does syntax checking was probably incorrect. It does want to do a whole compile + link to catch the same errors that a `go build` would report. re: $TMPDIR, that's probably generally a better idea. It's not any less platform-specific than /dev/null would be and doesn't require any changes. In a way, using /dev/null would be "too magic". Go doesn't write to a device, it creates a file, so handling /dev/null would be special and not the same meaning as the Unix meaning of it. |
lcd047
added a commit
to vim-syntastic/syntastic
that referenced
this issue
Jun 3, 2015
Running "go build -o /dev/null" in a main package that lives in GOPATH produces an error message: build output "/dev/null" already exists and is not an object file This issue won't be addressed on the Go side: http://code.google.com/p/go/issues/detail?id=4851 golang/go#4851 Consequently, syntastic leaves this to the user to resolve. Set g:syntastic_go_go_build_args to something including "-o /some/dir" to redirect the output of "go build".
robashton
pushed a commit
to robashton/syntastic
that referenced
this issue
Jun 12, 2015
Running "go build -o /dev/null" in a main package that lives in GOPATH produces an error message: build output "/dev/null" already exists and is not an object file This issue won't be addressed on the Go side: http://code.google.com/p/go/issues/detail?id=4851 golang/go#4851 Consequently, syntastic leaves this to the user to resolve. Set g:syntastic_go_go_build_args to something including "-o /some/dir" to redirect the output of "go build".
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: