gcircularqueue is Circular Queue in Golang
go get github.com/Focinfi/gcircularqueue
This package is a typical circular with interfaces as following:
Normal queue
queue := gcircularqueue.NewCircularQueue(size int)
Thread-safe queue via sync.RWMutex
queue := gcircularqueue.NewCircularQueueThreadSafe(size int)
isEmpty := queue.IsEmpty()
isFull := queue.IsFull()
queue.Push("kitty")
// note: it will panic if pushing a thing into a full queue
element := queue.Shift()
// note: `element will be nil when shifting from a empty queue