One of the key features in go is simplicity. As a result there are a number of utilities and data structures that are common in other high-level languages that do not come with the go stdlib.
One of them is a stack. Following is a very simple implementation of a stack that uses a slice to store the data.
The following is an implementation of a simple stack that takes any kind of pointer.
import "fmt"
type Stack[T any] struct
→ Continue reading “Implementing a Stack in Go”