go get github.com/Mottl/circularqueue
package main
import (
"fmt"
"github.com/Mottl/circularqueue"
)
func main() {
queue := circularqueue.NewQueue(64)
queue.Push(100)
queue.Push(101)
queue.Push(102)
queue.Push(103)
queue.PopAt(1) // 101, nil
queue.Pop() // 103, nil
fmt.Println(queue) // Queue (len=2, cap=64) [ 100, 102 ]
}
Use of this package is governed by MIT license that can be found in the LICENSE file.