assert.Regexp: Document allowed rx argument values #268
Author: brackendawsonCreated Sep 15, 2025Updated May 24, 2026
Labelsdocumentationpkg-assert
Reference: https://github.com/Antonboom/testifylint/issues/81#issuecomment-3290922001
The Regexp and NotRegexp assertions accept interface{} for the rx (expression) argument. This is insane but we can't change it because it would be a breaking change. The documentation for these functions should be changed to explain that the value should be a *regexp.Regexp, but that if any other type is provided then the %v format of the value will be compiled as a new expression.
Source: stretchr/testify