Append() is a 'safe append' when the caller wants to re-use the 'a' slice
(a, b []byte)
| 943 | |
| 944 | // Append() is a 'safe append' when the caller wants to re-use the 'a' slice |
| 945 | func Append(a, b []byte) []byte { |
| 946 | out := make([]byte, len(a)+len(b)) |
| 947 | copy(out, a) |
| 948 | copy(out[len(a):], b) |
| 949 | return out |
| 950 | } |
| 951 | |
| 952 | // AppendWithBuffer() appends a and b into a fresh []byte using a buffer to reduce allocations. |
| 953 | // The result is safe to retain and use independently of a/b/buffer. |
no test coverage detected