3 ms·
When I need to copy a slice it's usually a []byte. I'm looking forward to https://github.com/golang/go/issues/45038 https://github.com/golang/go/issues/45038
by icholy 5y ago
When I need to copy a slice it's usually a []byte. I'm looking forward to https://github.com/golang/go/issues/45038 https://github.com/golang/go/issues/45038
- kubb 5y agoThis interestingly touches on another frustrating property of go. Most of the people using it seem to have a different usage pattern than me. Because of that, the language is unlikely to fix the issues that are very real to me. The community claims they don't need them, the language designers, perhaps a bit more arrogantly, claim that I don't need them. Yet, I've used other languages where I've never had to consider this. I can clone whatever I want, whenever I want. If I only ever cloned []bytes, I'd write a helper function, keep it in an utility package and go on with my life. This ties back to the original theme of "it works well for certain things, but if you try to do something that the designers didn't predict, good luck to you".