3 ms·
There has to be a better way of doing this: numbers = append(numbers[:2], append([]int{3}, numbers[2:]...)...)
by flippant 11y ago
There has to be a better way of doing this:
numbers = append(numbers[:2], append([]int{3}, numbers[2:]...)...)
- tucnak 11y agoI am afraid there isn't. In fact, it's called a "slice trick" and listed in Go wiki: https://github.com/golang/go/wiki/SliceTricks https://github.com/golang/go/wiki/SliceTricks