{"id":"174f713365f24bc6","repo":"stretchr/testify","slug":"reset-is-deprecated","errorCode":null,"errorMessage":"Reset() is deprecated","messagePattern":"Reset\\(\\) is deprecated","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"assert/assertions.go","lineNumber":2066,"sourceCode":"}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (CollectT) Helper() {}\n\n// Errorf collects the error.\nfunc (c *CollectT) Errorf(format string, args ...interface{}) {\n\tc.errors = append(c.errors, fmt.Errorf(format, args...))\n}\n\n// FailNow stops execution by calling runtime.Goexit.\nfunc (c *CollectT) FailNow() {\n\tc.fail()\n\truntime.Goexit()\n}\n\n// Deprecated: That was a method for internal usage that should not have been published. Now just panics.\nfunc (*CollectT) Reset() {\n\tpanic(\"Reset() is deprecated\")\n}\n\n// Deprecated: That was a method for internal usage that should not have been published. Now just panics.\nfunc (*CollectT) Copy(TestingT) {\n\tpanic(\"Copy() is deprecated\")\n}\n\nfunc (c *CollectT) fail() {\n\tif !c.failed() {\n\t\tc.errors = []error{} // Make it non-nil to mark a failure.\n\t}\n}\n\nfunc (c *CollectT) failed() bool {\n\treturn c.errors != nil\n}\n\n// EventuallyWithT asserts that given condition will be met in waitFor time,","sourceCodeStart":2048,"sourceCodeEnd":2084,"githubUrl":"https://github.com/stretchr/testify/blob/001eb7946baf451879253643e4ce4b38eaa0d4a7/assert/assertions.go#L2048-L2084","documentation":"CollectT.Reset() (assert/assertions.go:2065) is an unconditionally panicking stub marked Deprecated. It was an internal helper that was accidentally exported and later removed; calling it always panics with this message. CollectT is the error-collecting TestingT used by EventuallyWithT.","triggerScenarios":"Calling collectT.Reset() on a *assert.CollectT instance — typically copy-pasted from old testify examples or a pre-1.8 codebase that used Reset to clear collected errors between iterations.","commonSituations":"Upgrading testify past the version where Reset was deprecated; following an outdated tutorial or Stack Overflow answer; generated test scaffolding that still calls Reset.","solutions":["Remove the Reset() call — CollectT is meant to be used once per EventuallyWithT run, not reset.","If you need a fresh error collector, allocate a new CollectT instead of resetting an existing one.","Search the codebase for '.Reset()' on CollectT values and delete those lines."],"exampleFix":"// before\ncollectT := &assert.CollectT{}\nassert.EventuallyWithT(collectT, func(*assert.CollectT) bool { ... }, ...)\ncollectT.Reset()\n// after\ncollectT := &assert.CollectT{}\nassert.EventuallyWithT(collectT, func(*assert.CollectT) bool { ... }, ...)","handlingStrategy":"validation","validationCode":"// Static prevention: search & remove collectT.Reset() calls.\n// No runtime guard is meaningful — Reset() always panics.","typeGuard":null,"tryCatchPattern":"// There is no recovery pattern; the method is intentionally gone.\n// Delete all .Reset() calls on *assert.CollectT values.","preventionTips":["After upgrading testify, grep for '.Reset()' on CollectT and remove.","Pin to the changelog entry that deprecated Reset.","Allocate a fresh CollectT per run instead of reusing/resetting."],"tags":["deprecated","collectt","panic","api-removal"],"analyzedSha":"001eb7946baf451879253643e4ce4b38eaa0d4a7","analyzedAt":"2026-08-04T21:49:58.715Z","schemaVersion":2}