Build your own slice: The append and copy functions
In this article, the author explains the concept of appending to a slice in Go and how it creates a new slice with the elements of the original slice plus the appended elements. The original slice remains untouched. The built-in append function is used for appending, and all elements must be of the same type as the elements of the slice.
The article also discusses the relationship between slices and arrays, highlighting that a new slice returned by append needs to be backed by an array. If the array of the original slice is large enough, append will use it to back the new slice. Otherwise, it will create a new backing array.
To demonstrate these concepts, the author provides code examples and encourages readers to try them out. This article is part of a series on slices, and readers are invited to sign up for the author's newsletter to receive notifications about new articles.
Overall, this article provides valuable insights into how to effectively use the append function and understand the underlying mechanisms of slices in Go.