quii / learn-go-with-tests

Learn Go with test-driven development
MIT License
22.03k stars 2.79k forks source link

Refactor `reflect.DeepEqual` to `slices.Equal` from the standard lib #721

Open konsalex opened 9 months ago

konsalex commented 9 months ago

Hey folks,

Would it make sense to add also the new way to compare slices in this chapter: https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/arrays-and-slices#write-enough-code-to-make-it-pass-4

So instead of using reflect.DeepEqual to use slices.Equal.

I could make a contribution to add this

dario-piotrowicz commented 4 months ago

The guide does mention slices.Equal here: https://github.com/quii/learn-go-with-tests/blob/06197122a021f6e61ae481f763d43c8b58a22721/arrays-and-slices.md?plain=1#L341

And go 1.21 has been out for a while: https://go.dev/doc/devel/release#go1.21.0

So I think it could make sense :thinking:

but I am not sure, maybe the guide tries to make zero assumptions on the go version being used? :shrug:

quii commented 3 months ago

I could make a contribution to add this

late reply, but if you're still willing, go for it!

konsalex commented 2 months ago

Will do with the first chance!