Go 1.27 made
stdversion checks run by default when running
go test as well as an extra check for
errors.Is compatibility. This checks for non-pointer types which appears to break compatibility with existing code, y
ou can see this here
Under go 1.26 the errors.Is works as expected but under 1.27 you get a compile failure.
If I remove the
& so it operates on HTTPError and not
*HTTPError as I believe is suggested by the vet check two of the tests fail as
HTTPError is not comparable.
I even tried with a custom Is function defined, go vet check still fails.
Am I missing something, or is this a significant compatibility breakage introduced by 1.27?
# [play]
./prog_test.go:27:44: %w wants operand of error type HTTPError, not pointer type *HTTPError (defeats errors.Is)
Go build failed.
=== RUN TestErrorsIs
=== RUN TestErrorsIs/wrapped-eof
=== RUN TestErrorsIs/wrapped-sentinel
prog_test.go:37: wrapped: &fmt.wrapError{msg:"wrapped eof error: EOF", err:main.HTTPError{error:(*errors.errorString)(0x86ae60), StatusCode:404, Details:[]interface {}{"some extra info"}}} is not sentinel
=== RUN TestErrorsIs/direct-sentinel
prog_test.go:42: sentinel: &fmt.wrapError{msg:"wrapped eof error: EOF", err:main.HTTPError{error:(*errors.errorString)(0x86ae60), StatusCode:404, Details:[]interface {}{"some extra info"}}} is not sentinel
--- FAIL: TestErrorsIs (0.00s)
--- PASS: TestErrorsIs/wrapped-eof (0.00s)
--- FAIL: TestErrorsIs/wrapped-sentinel (0.00s)
--- FAIL: TestErrorsIs/direct-sentinel (0.00s)
FAIL
Program exited.
=== RUN TestErrorsIs
=== RUN TestErrorsIs/wrapped-eof
=== RUN TestErrorsIs/wrapped-sentinel
=== RUN TestErrorsIs/direct-sentinel
--- PASS: TestErrorsIs (0.00s)
--- PASS: TestErrorsIs/wrapped-eof (0.00s)
--- PASS: TestErrorsIs/wrapped-sentinel (0.00s)
--- PASS: TestErrorsIs/direct-sentinel (0.00s)
PASS