Consider the following test on playground:
https://play.golang.org/p/PQuDmwMF5DG
There are two separate calls to errors.New, with an identical string argument.
Calling reflect.DeepEqual on those two error values returns true in 1.12 but false in tip (go version devel +01d1dc4172 Tue Mar 12 21:08:33 2019 +0000 darwin/amd64).
Some of the code bases I work in, have test suites that are passing on 1.12 but failing on tip
because they call reflect.DeepEqual on error values like the above example.
I'm pretty sure I've seen, in the past, recommendations against using reflect.DeepEqual with types you don't own.
So, fair enough, we shouldn't have been using reflect.DeepEqual with values returned from fmt.Errorf or errors.New.
go-cmp also reports that err1 and err2 are no longer considered cmp.Equal(), seemingly due to the new frame pointer information stored in errors.
(At least with whichever version of go-cmp we're using in those projects.)
It looks like the standard library tests comparing errors have changed from comparing err1 and err2, to comparing err1.Error() with err2.Error().
I'm mainly looking for confirmation -- is comparing the result of the Error method the preferred comparison approach for transitioning from go1.12 to tip/go1.13?
But I also wanted to post this as an early heads-up that end-users will likely have broken tests as the 1.13 beta comes around in a few months.
And I didn't find any other search results on the mailing lists discussing this yet.
I debated posting to golang-nuts, but I decided on golang-dev based on how early the 1.13 cycle is as of today.
Thanks,
Mark