go-algorand
go-algorand copied to clipboard
go 1.18 upgrade: Replace occurrences of `strings.SplitN(arg, sep, 2)` with `strings.Cut(arg, sep)`
Problem
Since go version 1.18, Cut() is available for splitting strings in the special case of n=2. The standard library's commentary for SplitN() seems to suggest that it is preferred:
Reference
https://pkg.go.dev/strings#Cut
Solution
Replace all occurrences in the codebase for splitting strings into exactly 2 pieces using strings.SplitN() to use strings.Cut(). Since the API's are not identical, an automatic change would require some thought, and it may end up easier to make the changes manually.
Dependencies
Urgency
Low