Most of the time you don't have to explicitly create a slice. Zero value of a slice is nil and append works with that:

https://codeeval.dev/gist/a688c2c364cfa84c9d6a1f62d1dc15d0

There are 2 ways to create an empty slice:

https://codeeval.dev/gist/5734aef9cb2aed722b53eb1b56e89042

Empty slice is different than nil slice.

Create statically pre-allocated slice:

https://codeeval.dev/gist/c30cad1c332c412cbf598faf640e8028

Pre-allocate slice filled with zero values:

https://codeeval.dev/gist/ad683c89ebc61ff3afe91be57b985d3b

If you know the expected size of the slice, you can pre-allocate space for its content, which helps performance:

https://codeeval.dev/gist/692f0e7b042adbb495acacc7c17b4ed7