On Sun, 2021-12-05 at 13:24 -0800, arthurwil...@gmail.com wrote: > How is it possible for this test case to ever fail? > > // Same allocation should be equal to itself (not crash). > err := errors.New("jkl") > if err != err { > t.Errorf(`err != err`) > } > https://cs.opensource.google/go/go/+/master:src/errors/errors_test.go;drc=519474451a44b861e54466998a893a173bd54c4b;l=24 >
If errors.errorString ever was changed to contain a slice or func or other non-comparable type and the type were made a non-pointer, the equality would crash https://go.dev/play/p/yOIeVA2LsG1 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/81748be1eb571f8aa5a4c59e78da4c9f0c2dddd6.camel%40kortschak.io.