cmd/go: go test -c does not accept -o $dir #58162

175 views
Skip to first unread message

Maksadbek

unread,
Feb 2, 2023, 2:52:22 PM2/2/23
to golang-dev
Hi all,

The issue states that `go build` has allowed one to build multiple packages and write their executables to a directory, and `go test` should also implement the same behaviour.

I want to work on this feature, and my question is should the -o $dir flag generate one executable test file for all packages or multiple executables for each package ?

I've asked this question in the issue comments, but no answer. So I'm reposting it here.

Thanks,
Maksadbek

Russ Cox

unread,
Feb 2, 2023, 2:59:03 PM2/2/23
to Maksadbek, golang-dev
Hi Maksadbek,

Thanks for working on that issue. 'go test -c' of multiple packages should build multiple test binaries, the same way 'go test' of multiple packages does. I assume the binaries should be named the same thing they would be named when using 'go test -c' of a single package, which is to say 'packagename.test[.exe]'. That means if you run 'go test -c math/rand crypto/rand' there should probably be an error reported about the conflict between two different rand.test. 'go build -o' of multiple commands also seems to be missing this check.

Thanks again!

Best,
Russ
 

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-dev/d01cbe3d-407f-4059-9ee5-b5688dbb9342n%40googlegroups.com.

Maksadbek

unread,
Feb 9, 2023, 4:02:32 AM2/9/23
to Russ Cox, golang-dev
Hi Russ,

Thank you for your response. I created a CL yesterday, https://go-review.googlesource.com/c/go/+/466397. It probably needs some fixes, i.e. amend the error message. Could you please review it ?

Thanks,
Maksadbek
Reply all
Reply to author
Forward
0 new messages