On Thu, Mar 9, 2023 at 8:11 AM Samuel Nelson <valczir.darkv...@gmail.com> wrote: > > I am a maintainer of a library that was calling `t.Run` inside of > `t.Cleanup`, in order to call test functions after everything (the test > functions and their corresponding setup/teardown functions) had been > registered. Go 1.20.x changed that so that `t.Run` cannot be called inside of > `t.Cleanup`, and it's not mentioned anywhere in the release notes or the > `testing` package docs. The package in question: > https://pkg.go.dev/github.com/poy/onpar/v2. Here's where we register the > `Run` calls during `Cleanup`: > https://github.com/poy/onpar/blob/v2.0.1/onpar.go#L70-L72 > > I don't particularly _mind_ the library breaking (clearly we were relying on > unsupported functionality), but this feels like something that should have > been mentioned - at least in the release notes, maybe also in the `testing` > docs. Is this something I should bring up in a github issue or something?
Thanks, I saw the comment in the GitHub issue, and I've sent https://go.dev/cl/475215 to update the release notes. Cleanup is documented to run when all subtests complete, so it's kind of contradictory to start a new subtest in a Cleanup. I'm not sure we need to document it there. But I don't feel strongly about it. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWM6wcW%3Dcd_tboSjMDiFpSSL9R4F0bqeaN0qt6k6197gA%40mail.gmail.com.