Skip to content

Instantly share code, notes, and snippets.

@snassr
Last active September 12, 2022 22:26
Show Gist options
  • Save snassr/d5cbb62e9bb313a751fa4c621416d214 to your computer and use it in GitHub Desktop.
Save snassr/d5cbb62e9bb313a751fa4c621416d214 to your computer and use it in GitHub Desktop.
Medium Blog - Unit Testing in Go (Golang) - Singly Linked List FIle
// SinglyLinkedList implements a list of items.
type SinglyLinkedList interface {
Append(val int)
Values() []int
}
// NewSinglyLinked list returns a new list.
func NewSinglyLinkedList(vals ...int) SinglyLinkedList {
return newList(vals...) // swap different implementation constructor here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment