Go 1.26 will see the addition of function errors.AsType, which improves upon errors.As and should be preferred over the latter:
The new AsType function is a generic version of As. It is type-safe, faster, and, in most cases, easier to use.
Accordingly, when Go 1.26 gets released, all calls to errors.As should be replaced by calls to errors.AsType.