-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: add build -json, to report build failures in JSON #23037
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
Comments
In general the go tool does not support multiple packages in a single directory. Can you give a small complete example? |
run |
Thanks. For future reference, when I ask for a small complete example, it really helps a lot if you can give a complete example, which means the exact files and the exact commands. Otherwise I have to guess what you mean when you say "nonCompilablePackage", and experience tells me that I often guess wrong. Here is a complete example that may show the problem: src/p1/p1.go package p1
func F() {} src/p1/p1_test.go package p1
import "testing"
func TestF(t *testing.T) {
F()
t.Log("F")
} src/p2/p2.go: package p2
func F() {}
this file will not compile src/p2/p2_test.go: package p2
import "testing"
func TestF(t *testing.T) {
F()
t.Log("F")
}
If I understand you correctly, you are saying that you would like to have JSON output that reports that we were unable to build package CC @rsc |
Yes, that's correct. |
You're asking for go build -json. We are only adding go test -json in this release. Maybe in a future release we could add go build -json and make go test imply that flag. Sorry. |
Unfortunately, there is no go build json output as of yet (golang/go#23037)
Unfortunately, there is no go build json output as of yet (golang/go#23037)
@rsc It seems like the |
I've filed a concrete proposal for |
Change https://go.dev/cl/536397 mentions this issue: |
Duplicate of #62067 |
This adds support for a "-json" flag in all build-related go subcommands. This causes build output and build failures to be reported to stdout in a machine-readable way. For #62067. Fixes #23037. Change-Id: Id045c5bd5dde9d16cc09dde6248a4b9637896a30 Reviewed-on: https://go-review.googlesource.com/c/go/+/536397 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Russ Cox <[email protected]>
If I run
go test
on a directory and one of the packages is failed to run, I won't get any json output for it.It would be great to have at least a single package-fail json-message.
The text was updated successfully, but these errors were encountered: