diff --git a/queue.go b/queue.go index 76f4d90..4b5c444 100644 --- a/queue.go +++ b/queue.go @@ -5,7 +5,7 @@ package queue type Item struct { - val interface{} + Val interface{} } // This type represents request for content from queue. diff --git a/queue_test.go b/queue_test.go index 4fa0441..62426d9 100644 --- a/queue_test.go +++ b/queue_test.go @@ -10,7 +10,7 @@ import ( func TestPut(t *testing.T) { q := NewQueue() q.Put(Item{1}) - if q.Get().val.(int) != 1 { + if q.Get().Val.(int) != 1 { t.Fatal("wrong item in queue") } } @@ -19,7 +19,7 @@ func TestPutMultiple(t *testing.T) { q := NewQueue() q.Put(Item{1}) q.Put(Item{2}) - first, second := q.Get().val.(int), q.Get().val.(int) + first, second := q.Get().Val.(int), q.Get().Val.(int) if first != 1 || second != 2 { t.Fatal("wrong item in queue or wrong order") } @@ -66,7 +66,7 @@ func TestGetMany(t *testing.T) { select { case res := <-result2(): - third, fourth := res[0].val.(int), res[1].val.(int) + third, fourth := res[0].Val.(int), res[1].Val.(int) if third != 3 || fourth != 4 { t.Fatal("wrong item in queue or wrong order") } @@ -92,7 +92,7 @@ func TestConcurrent(t *testing.T) { for i := 0; i < 1000; i++ { go func() { defer wg.Done() - sum += q.Get().val.(int) + sum += q.Get().Val.(int) }() }