-
-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse mutating? #160
Comments
@xyluet I guess they know it because almost all methods here mutating the inputs
|
@xyluet I've found out this lib www.github.com/thoas/go-funk, not sure if it is much better, but at least "reverse" func isn't mutate an input array) |
Good catch @xyluet ! I doubt that's expected. I had a quick look and it looks like only |
I had the same problem. And I think it will be more apparent if the |
Many libraries have used the following method to convert String to []byte. If the method modifies the original data, panic will occur. func StringToBytes(s string) []byte {
return unsafe.Slice(unsafe.StringData(s), len(s))
} Just like this kind of code, panic will appear: |
Available as an option |
method
Reverse
is mutating the original collection, is this expected?output:
The text was updated successfully, but these errors were encountered: