Skip to content
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 compiling all tests without running #15513

Closed
bradfitz opened this issue May 3, 2016 · 64 comments
Closed

cmd/go: support compiling all tests without running #15513

bradfitz opened this issue May 3, 2016 · 64 comments

Comments

@bradfitz
Copy link
Contributor

bradfitz commented May 3, 2016

I want this to work:

$ go test -c std cmd
cannot use -c flag with multiple packages

But I don't actually care about the binaries. I just want to test that all the tests can compile, and how fast. @randall77 also wants this for SSA coverage reasons.

@bradfitz bradfitz added this to the Unplanned milestone May 3, 2016
@cespare
Copy link
Contributor

cespare commented May 3, 2016

Is go test -run xxxxx std cmd a reasonable workaround for at least some of those use cases?

@josharian
Copy link
Contributor

josharian commented May 3, 2016

And I want this, but I do want the test binary. I'd use it to compile tests, change the compiler, compile tests again, and then run before/after benchmarks. (All in a script, of course.) Like toolstash for std tests. I currently do something similar but with go list std and a lot of bookkeeping and go test -c invocations.

It seems to me we could generate a testmain that invokes all the tests in all the included packages. There are some questions: How do you know from the -v output which package this particular instance of TestReader is from? How does the -run filter work? And so on. My hand-waving answer is: Mimic the UI for subtests and sub benchmarks, which already have this nesting problem; the nesting is just up a level rather than down.

@minux
Copy link
Member

minux commented May 3, 2016 via email

@josharian
Copy link
Contributor

What if we leave that up to the user to diagnose? If package A's test interferes with package B's use of package A, then don't test them together. This sort of issue can already arise in a single package.

@minux
Copy link
Member

minux commented May 3, 2016 via email

@josharian
Copy link
Contributor

They'll know when the test fails. If the tests pass when run independently (i.e. go test ./..., no -c), then there's clearly an interaction problem.

@minux
Copy link
Member

minux commented May 3, 2016 via email

@josharian
Copy link
Contributor

I can't imagine someone wanting to run go test -c ./... on their entire GOPATH unless they had a very good reason. I can, however, see this for a particular project or set of packages, in which case this becomes very useful. Think e.g. of cross-compiling all the tests for your project and having to only scp a single binary.

cmd/go doesn't support negative patterns

Yes, this is unfortunate.

I apologize, but I don't quite understand the resistance here. It seems like the resistance is "something could go wrong". But this doesn't really seem like a big footgun to me. And when this is helpful, like cross-compiling all tests for a big project or keeping around an old version for benchmarking or testing compilation speed, it is very helpful, and users will be motivated to make it work (or not use it). And it is entirely backwards compatible.

@minux
Copy link
Member

minux commented May 4, 2016

I think this issue gives one reason for do go test -c ./... for the
whole GOPATH: test the SSA compiler code generation.

The key point is most tests are not prepared for this.
How many packages support go test -count=2?
Even some of the std packages don't, until they're
fixed not long ago.

And how do you propose to handle conflicting flags added
by tests and multiple TestMains? Again, these features
are just not designed to combine tests for multiple packages
into a single executable.

Also note that tests for a package needs to run at the
directory for the package, how to handle that when
tests for multiple packages are combined into one binary?

(FTR, I have been thinking about this feature a long time
ago, but my conclusion was and still is that the whole thing
is not designed for this.)

@josharian
Copy link
Contributor

How many packages support go test -count=2? Even some of the std packages don't, until they're
fixed not long ago.

Exactly. And they got fixed because people cared. Same situation here, I'd say.

conflicting flags added by tests

Sorry, what do you mean by this?

multiple TestMains

Refuse to compile, with a lucid error message. Rare.

tests for a package needs to run at the directory for the package

os.Chdir? Note that the go command has the directory available at compilation time. This is a bit ugly for the cross-compilation case, but we could print a warning instead of failing when os.Chdir fails.

I have been thinking about this feature a long time
ago

Yeah, I recall there being another issue about this but couldn't find it.

I agree that there are limitations, I just see them as limitations rather than showstoppers.

@minux
Copy link
Member

minux commented May 4, 2016

By conflicting flags added by tests, consider two
packages that both add -update flags to update
golden output of their test data.

The code will compile, but will fail at runtime with
a flag redefined panic.

There are just too many global states, hence I
said the whole system is not designed for this.

@mattklein123
Copy link

I'm new to Go, but FWIW, the lack of this feature is one of the most frustrating things that I have found so far about the tooling. I tend to write production code and test code at the same time, and during my normal dev cycle I want to see if things compile many more times than I want to run the tests. So right now I'm doing roughly the same thing as stated above inside my project with a few packages: basically

for i in go list ./...; do go test -c $i; done

It would be great if this could be done in one pass with a single link and have it be up to the user to deal with conflicts as suggested by @bradfitz

@davecheney
Copy link
Contributor

If you want to compile but run not tests,

 go test -run=nope ./...

Replace nope with another pattern if you have test cases that match.

On Fri, 27 May 2016, 03:45 Matt Klein notifications@github.com wrote:

I'm new to Go, but FWIW, the lack of this feature is one of the most
frustrating things that I have found so far about the tooling. I tend to
write production code and test code at the same time, and during my normal
dev cycle I want to see if things compile many more times than I want to
run the tests. So right now I'm doing roughly the same thing as stated
above inside my project with a few packages: basically

for i in go list ./...; do go test -c $i; done

It would be great if this could be done in one pass with a single link and
have it be up to the user to deal with conflicts as suggested by @bradfitz
https://github.com/bradfitz


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#15513 (comment)

@mattklein123
Copy link

@davecheney I'm probably doing something stupid but running that command still causes all the tests to execute. I tried:

go test -run nope ./...

Also still runs tests.

@davecheney
Copy link
Contributor

Please try -run=nope

On Fri, 27 May 2016, 09:56 Matt Klein notifications@github.com wrote:

@davecheney https://github.com/davecheney I'm probably doing something
stupid but running that command still causes all the tests to execute. I
tried:

go test -run nope ./...

Also still runs tests.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#15513 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAcA8xNrwQtBDQEF3AeZEF-377nOLMUks5qFjMwgaJpZM4IV2e-
.

@mattklein123
Copy link

I tried both:

mklein@vm:~/Source/go/src/github.com/<redacted>$ go test -run=nope ./...
ok      github.com/<redacted>   0.025s

@cespare
Copy link
Contributor

cespare commented May 27, 2016

-run=nope and -run nope are equivalent.

@mattklein123 no tests are being run (probably). Use -v to confirm.

Please use the mailing list if you have further questions about go test.

@davecheney
Copy link
Contributor

That is correct. The test binary is built and executed, but none of the
test cases will be executed because they don't match the -run filter

On Fri, May 27, 2016 at 10:11 AM, Caleb Spare notifications@github.com
wrote:

-run=nope and -run nope are equivalent.

@mattklein123 https://github.com/mattklein123 no tests are being run
(probably). Use -v to confirm.

Please use the mailing list if you have further questions about go test.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#15513 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAcA8u95PM2MDjAGCytHBIVmp0py0RIks5qFjaxgaJpZM4IV2e-
.

@jurij
Copy link

jurij commented Sep 2, 2016

i prefer -run ^$

@bradfitz
Copy link
Contributor Author

bradfitz commented Sep 8, 2016

My motivation is for the builders, and test sharding.

The problem with go test -run=^$ std cmd is that it deletes the *.test binaries afterwards. I want the test binaries, to ship around the network and shard out isolated test execution. But I want to burn CPU as hard as possible where it's not latency sensitive. (That is, I can run compilation jobs at 100% CPU, but tests are often flaky at 100% if they sleep or depend on time.)

@bradfitz bradfitz modified the milestones: Go1.8Maybe, Unplanned Sep 8, 2016
@bradfitz bradfitz added Builders x/build issues (builders, bots, dashboards) Proposal labels Sep 8, 2016
@bradfitz bradfitz changed the title cmd/go: support compiling all tests without running proposal: cmd/go: support compiling all tests without running Sep 8, 2016
@minux
Copy link
Member

minux commented Sep 9, 2016 via email

@bradfitz
Copy link
Contributor Author

bradfitz commented Sep 9, 2016

I can do it myself, but my concern is that I can't keep the CPU busy as well as the cmd/go binary could.

cmd/go can load the dependency graph once, come up with a plan, and keep a certain number of worker processes running at all times.

Any coordination I do trying to run multiple cmd/go binaries wouldn't be as good.

Definitely low priority, though.

@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 20, 2016
@bcmills
Copy link
Contributor

bcmills commented Feb 2, 2023

@mknyszek and @prattmic pointed out that on Unix platforms go test -exec /bin/true does seem to support compiling the tests without running them today. 😅

@howardjohn
Copy link
Contributor

You can speed things up a lot faster with https://gist.github.com/howardjohn/c0f5d0bc293ef7d7fada533a2c9ffaf4 by avoiding linking the binaries. A warm run on even huge repos like k8s can do this in 1-2s on my machine.

@bcmills
Copy link
Contributor

bcmills commented Feb 3, 2023

@howardjohn, it may be faster but it's not the same. Link-time errors are possible in pure Go programs and even fairly common in cgo programs.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/466397 mentions this issue: cmd/go: make go test build multiple executables

@samsalisbury
Copy link

At last! Excited to see this supported by the toolchain, will avoid nasty hacks like this in the future 😂

@bcmills
Copy link
Contributor

bcmills commented Feb 15, 2023

So, one minor detail: for a single package, go test -c $pkg would be equivalent to go test -c -o $(pwd)/ $pkg.

For consistency, should go test -c ./... also write test binaries in the current working directory for all matching packages?
(I think it probably should.)

@samsalisbury
Copy link

should go test -c ./... also write test binaries in the current working directory for all matching packages?

How would conflicts be avoided here, with multiple packages of the same name but different paths?

Just thinking about a general solution for different use-cases... If -o supported a template you could use e.g. -o '{{.pkgPathRel}}.test" (maybe that should be the default to avoid the possibility of conflicts). It could then be set to {{.pkgName}}.test to write them all to the same dir. This would also remove the need for a special-case for /dev/null, as /dev/null would be a valid template...

@bcmills
Copy link
Contributor

bcmills commented Feb 16, 2023

How would conflicts be avoided here, with multiple packages of the same name but different paths?

Conflicts would cause the go invocation to fail. (But go test -c ./... already fails today if ./... matches more than one package at all, so no invocation that works today would start failing as a result.)

If -o supported a template you could use e.g. -o '{{.pkgPathRel}}.test" (maybe that should be the default to avoid the possibility of conflicts).

I think that's probably overkill. I expect that the vast majority of uses will be -o /dev/null, and consistency with go build -o is important to provide a predictable UX.

@samsalisbury
Copy link

Thanks for the explanation @bcmills

Conflicts would cause the go invocation to fail.

Just saw the test for this in the CL, apologies I missed it the first time. However, being able to robustly build all test binaries would seem necessary to satisfy e.g. @bradfitz's comment about sharding them over the network (it's an old comment but I can still see reasons we'd want to be able to do this).

For my own use cases, I've written scripts using go list and go test -c to achieve this sort of thing, but having it supported by the tool would be very useful... Having said that it's probably the 1% case, where -o /dev/null is the 99%...

@bcmills
Copy link
Contributor

bcmills commented Feb 17, 2023

Yeah, I agree that those cases exist but I think the solution for them is, as you mentioned, to have those cases run go test -c with the specific packages they want to build. It's a bit more coding work but it's also a more complicated and nuanced use-case (precisely because of those kinds of collisions).

@dmitshur dmitshur modified the milestones: Backlog, Go1.21 Feb 27, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/488275 mentions this issue: cmd/dist: actually only compile tests with -compile-only

gopherbot pushed a commit that referenced this issue Apr 25, 2023
Currently, "dist test -compile-only" still runs the test binaries,
just with -run=^$ so no tests are run. It does this because, until
recently, "go test -c" would fail if passed multiple test packages.
But this has some unexpected consequences: init code still runs,
TestMain still runs, and we generally can't test cross-compiling of
tests.

Now that #15513 is fixed, we can pass multiple packages to "go test
-c". Hence, this CL make dist just use "go test -c" as one would
expect.

Found in the course of working on #37486, though it doesn't really
affect that.

Change-Id: If7d3c72c9e0f74d4ea0dd422411e5ee93b314be4
Reviewed-on: https://go-review.googlesource.com/c/go/+/488275
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/500956 mentions this issue: doc/go1.21: document forward and backward compatibility

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/500955 mentions this issue: cmd/go: document changes to go test -c and -o

gopherbot pushed a commit that referenced this issue Jun 5, 2023
Also handle go test -c TODO.

For #15513.
For #56986.
For #57001.

Change-Id: I571ae25d8d8fcd44cb38ac16cdd2a1180016eb94
Reviewed-on: https://go-review.googlesource.com/c/go/+/500956
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Jun 6, 2023
This was missing from CL 466397.

For #15513.

Change-Id: I138b7d76842815f4e702d7fe551aa8968097f75b
Reviewed-on: https://go-review.googlesource.com/c/go/+/500955
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
@howardjohn
Copy link
Contributor

This is super useful, thanks everyone involved. I opened a followup issue here: #61199 that I think can help make this more useful.

trajan0x added a commit to synapsecns/sanguine that referenced this issue Sep 10, 2023
dwasse added a commit to synapsecns/sanguine that referenced this issue Sep 13, 2023
* [goreleaser]

* up to calling submitStateReport

* barebones report invalid state in snapshot. need to update root PR

* make contract interfaces return txs for submitter

* [goreleaser]

* Cleanup: setup in parallel

* staging: working on fraud_test notary signature

* WIP: working thru fraud test

* WIP: working test

* Cleanup: remove logs

* Cleanup: more logs

* Fix: throw error for int64 overflow in EncodeState()

* WIP: fraud attestation handling

* WIP: add TestReportAttestationNotOnSummit

* WIP: testing. not getting log for submitAttestation event

* WIP, getting error of datahash code 0x184fb2df0de4da8049867b20a0d8b823d4590d0f3c9881144e53690eb2f67fe7

* WIP: successfully submitting fraudulent attestation. now debugging guards report

* WIP: working TestReportAttestationNotOnSummit

* Cleanup: test, remove logs

* Cleanup: remove GetAttestationComputeHash(), instead calculate hash as input

* Cleanup: remove unnecessary TestEncodeChainGasParity for now

* Cleanup: remove init() used for debugging lightinbox.metadata.go

* Cleanup: de-functionalize slashAccusedAgent() for consistency

* WIP: adding submitAttestationReport

* working submitattestationreport

* WIP: getting a signature for the STATE report

* small changes before handoff

* WIP: verifyStateWithAttestation case impl

* Feat: add TestReportFraudulentStateInAttestation

* staging. added a getter to the bondingmanager

* working test for fraudulentstateinattestation

* WIP: add receipt type with encoder

* WIP: add TestInvalidReceipt and handleReceipt impl

* CLEANME: added checks to test and start with tips encoding parity

* WIP: working case 1 of agnetStatusUpdate

* WIP: opendispute handling

* Cleanup: guard impl

* Cleanup: remove checks from event parser methods

* start of db implementation

* fix

* fillbytes

* fix

* staging

* Cleanup: remove printing reverts

* WIP: add getTestGuard() helper

* working receipt fraud test

* Cleanup: add bumpTx helper

* Cleanup: utilize AgentFlagType enum for AgentStatus.Flag values

* Cleanup: use getTestGuard() helper in all tests

* Cleanup: remove unnecessary test code

* Feat: add DisputeStatus type, GetDisputeStatus() call to BondingManager

* Feat: guard checks dispute status before submitting state report

* Cleanup: remove embedded lightinbox

* Cleanup: Domain -> AgentDomain

* WIP: verify agent status before slashing

* working multiple state case

* start to sql queries for crosstable dispute handling

* WIP: implement db queries and logic for updateAgentStatus() call

* WIP: fix cyclic deps

* Fix: build errs

* Add db tests

* wip: crosstable

* passing TestGetUpdateAgentStatusParameters

* working crosstable testrs

* WIP: add updateAgentStatuses()

* Feat: working anvil backend for fraud tests

* WIP: add evm.IncreaseTime() call

* clean and reformat query

* WIP: add bumpBackends()

* WIP: merge handling of DisputeOpened on remote / summit

* Cleanup: remove logs

* Fix: build

* Cleanup: some lints; guard parses RootUpdated events

* Cleanup: more lints

* Cleanup: remove unnecessary param in VerifyStateWithSnapshot()

* Cleanup: more lints

* Cleanup: more linting

* Cleanup: remove comments

* Cleanup: merge isStateSlashable() logic

* Cleanup: unused params

* Cleanup: another unused param

* Cleanup: move event parsers to utils.go

* Cleanup: move handlers to fraud.go

* Cleanup: add comments for fraud handlers

* Cleanup: comments

* De-duplicate agent signing logic (#1228)

* WIP: merge common signing logic into sign() util

* WIP: add Encoder interface for signed types

* Feat: add consts for salt values

* Cleanup: remove specific language from generic signEncoder func

* Fix: parity tests

* Cleanup: lint

* Fix: don't parse notary err on ctx cancel

* Cleanup: enable TestGuardE2E

* Cleanup: err msg

* Fix: ignore ctx cancel err  in agents integration test

* Fix: TestAgentsE2E

* Fix: avoid int64 overflow in executor tests

* Cleanup: resolve merge conflict

* Cleanup: merge conflict

* Feat: add NowFunc for time override

* WIP: executing mngr msg

* WIP: debugging GetLatestSummitBlockNumber()

* wip: friday progress

* Feat: add PassAgentRoot to destination interface

* WIP: parse RootUpdated on light manager, submit extra attestation and bump optimistic period on destination

* WIP: manually pass in agent root in last attestation

* Feat: guard db uses GetBlockNumberForRoot()

* WIP: working test

* Feat: correct block number condition

* Cleanup: remove logs

* Cleanup: more logs

* Cleanup: more cleanup

* Cleanup: remove unnecessary event parsing, re enable guard submitter

* add GetSummitBlockNumberForRoot test

* Cleanup: logs

* Fix: re enable submitter in notary

* Cleanup: go mod tidy

* small lint

* reduce again

* support for remote scribe in guard commands

* trivial fixes

* Fix: retry contract deployment

* Extra state reports (#1287)

* Feat: submit state reports to remote chains

* Feat: add SubmitStateReportWithAttestation on LightInbox

* WIP: verify number of reports on agent domain

* Feat: add prepareStateReport() for all report submissions

* Feat: add working state report verification to TestReportFraudulentStateInAttestation

* Feat: add verifyStateReport() helper

* Feat: add verifyStateReport() helper

* WIP: add RelayableAgentStatus model

* Cleanup: remove unused dispute handling

* WIP: working TestFraudulentStateInSnapshot with new agent status model

* WIP: fix crosstable logic, logs

* Feat: add NotaryOnDestination to test setup

* WIP: working test with NotaryOnDestination and Order clause in db query

* Cleanup: logs, dead code

* Fix: db tests

* Cleanup: lints

* Cleanup: remove Debug() gorm flags

* Feat: add updateAgentStatus() test helper

* Cleanup: update db comment

* Cleanup: correct db comment

* Fix: some lints

* Cleanup: lint

* Cleanup: clear nonce

* Submitter and Retries for Fraud (#1288)

* wrap each func. need to fix test

* working tests with submitter

* remove test file

* start to sql queries for crosstable dispute handling

* retries and print statements to be deleted

* undo generic retry

* remove test files

* remove other test file

* working tests

* remove print statement in executor

* implement wasse suggestions

* [goreleaser]

* fraud report branch

* gosum

* upterm

* assert->require

* log json receipt of failed txes

* receipt

* try nightly (this is a longshot)

* shorten ci runs

* shorten ci runs

* throw reverts at deployer level in addition to solidity level

* throw reverts at deployer level in addition to solidity level

* test some ideas

* remove for

* hi

* redundant

* generation fix [ci skip]

* fatal

* summit

* real chain id

* update

* uptemr

* [ci skip]

* fix host port to not be bound to hostname

* Fix: add index to avoid 'ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint' error

* upterm

* REVERT THIS. test changing all jaeger to null

* re enable workflow

* Revert "re enable workflow"

This reverts commit f5ca330.

* Revert "REVERT THIS. test changing all jaeger to null"

This reverts commit 2320a1c.

* start to sql queries for crosstable dispute handling

* dont run upterm

* upterm

* Fix: log tx hash within submitter

* Fix: do MIN(block_number) in db query

* error instead of warn

* Delete agents/agents/guard/test.txt

* Delete agents/agents/test.txt

* no jaeger in CI

* upterm

* Add logs

* add agent status prints

* omnirpc and increase evm increaase time by 30 secs

* fix: DDDDDDDD

* no more jaeger in ci

* Retry guard constructor

* Disable upterm

* Add check for nil guard

* Enable upterm

* Enable test without pyroscope / cov

* Bump timeouts

* Add back env vars

* Add upterm

* Log err on anvil purge

* Lint

* Add time log

* Printf

* Add address to anvil log

* Remove mem limit and enable gc

* max retry to 60 secs

* maxTotalTime on guard construcotR

* swing for the fences

* agents lint

* core lint fix

* Fix: yaml lint

* Revert "Add address to anvil log"

This reverts commit 3e401d7.

* Add codecov back to workflow

* try with run instead of command

* Use command instead of run with multiline content

* clean comments

* Fix: yaml lint

* redo go.yml

* Cleanup: gh action retries

* Cleanup: remove getTestGuard() retry

* working with some noncemanager removals

* working with all noncemanager removals

* precompile tests

* up the memlimit [no_skip] [goreleaser]

* hi [goreleaser]

* fix malformed memlimit

* reintroduce pyroscope [goreleaser]

* try to fix codecov

* github

* rename coverage.txt to profile.cov

* utilize precompilation (see: golang/go#15513)

* f

* try disabing pyroscope again

* list containers at the end [revert me] [goreleaser]

* fix the issue

* minimal log collection

* go.yml

* tmp logs

* Fix: use iota+1 for contract type

* fix: anvil test and delete debugging

* Fix: address flakes in TestUpdateAgentStatusOnRemote by bumping backends

* Cleanup: add grouped stdlib imports in editorconfig

* Cleanup: add TODO

* fix: mkdir for tmp logs for tar logs

* Cleanup: use dockerutil.GetPort()

* Cleanup: isNotSummit -> isNotary

* Cleanup: more descriptive comment on GetPort() behavior

* create parent dir for tmp logs

* fix: add iota + 1 where applicable

* Fix: bump backends after updateAgentStatus()

* use different dir for getting the logs

* revert iota + 1 in agents/contract

* undo iota + 1 in agents/types

* Add logs

* sleep pass

* Revert "Add logs"

This reverts commit 8637cb6.

* Fix: verify snapshot states before bumping evm time

* Cleanup: lint

* Config: bump retries

* Config: add on_retry_command to rm docker containers

---------

Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: Max Planck <99688618+CryptoMaxPlanck@users.noreply.github.com>
@PapaCharlie
Copy link

For posterity, and anyone who wants to include this in their build, the following command finds all the packages in the current directory:

go list -f '{{if .TestGoFiles}}{{.ImportPath}}{{end}}' ./...

So checking if all the tests compile can be accomplished like this:

go test -c -o /dev/null $(go list -f '{{if .TestGoFiles}}{{.ImportPath}}{{end}}' ./...)

@rsc rsc removed this from Proposals Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.