Package list golang-gopkg-eapache-queue.v1 / b6f8f25
Slightly more informative error messages Evan Huus 7 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
5454 // if the queue is empty.
5555 func (q *Queue) Peek() interface{} {
5656 if q.count <= 0 {
57 panic("queue: empty queue")
57 panic("queue: Peek() called on empty queue")
5858 }
5959 return q.buf[q.head]
6060 }
6363 // invalid, the call will panic.
6464 func (q *Queue) Get(i int) interface{} {
6565 if i >= q.count || i < 0 {
66 panic("queue: index out of range")
66 panic("queue: Get() called with index out of range")
6767 }
6868 return q.buf[(q.head+i)%len(q.buf)]
6969 }
7272 // want the element, call Peek first. This call panics if the queue is empty.
7373 func (q *Queue) Remove() {
7474 if q.count <= 0 {
75 panic("queue: empty queue")
75 panic("queue: Remove() called on empty queue")
7676 }
7777 q.buf[q.head] = nil
7878 q.head = (q.head + 1) % len(q.buf)