Is there a bug or issue on this in their GitHub cause wtf is this ?
This is expected behavior. It's just an easy thing to screw up by accident.
Re:Data Race Patterns in Go
by sethammons on Saturday June 11, 2022 @03:24PM
(#31707417)
Amazing, very interesting
It does exactly that, yes: https://go.dev/play/p/rs2FeK_QUjs
But maybe it doesn't: https://go.dev/play/p/Na-eL0sOV9e So... maybe they share the same backing array? Lets try setting s2[0] to "z" after appending with the original code: https://go.dev/play/p/mAB-gUb0shB Apparently not. But also apparently yes? https://go.dev/play/p/k1ciGzyS2gc Let's try appending just one more item before redoing ^ that example, where they all shared the same data: https://go.dev/play/p/5JneXHMeUjx Notice that in all of these examples, I haven't explicitly declared a length or capacity. There's nothing "funny looking" or clearly intentionally allowing these different behaviors, it's just simple, very-common slice use..... so yeah. This is a source of a number of hard-to-track-down bugs.