From 966dceacbd9ec710a9aa3b18470d6905a472ff78 Mon Sep 17 00:00:00 2001 From: Tomasz Janiszewski Date: Tue, 28 Jan 2020 18:45:22 +0100 Subject: [PATCH] Use bytes.Repeat instead of custom implementaion It looks like we reimplemented bytes.Repeat functionality with blob function. Lets use as much code from stdlib as possible. --- bigcache_test.go | 6 +----- queue/bytes_queue_test.go | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/bigcache_test.go b/bigcache_test.go index 38604c00..48d5efca 100644 --- a/bigcache_test.go +++ b/bigcache_test.go @@ -853,9 +853,5 @@ func (mc *mockedClock) set(value int64) { } func blob(char byte, len int) []byte { - b := make([]byte, len) - for index := range b { - b[index] = char - } - return b + return bytes.Repeat([]byte{char}, len) } diff --git a/queue/bytes_queue_test.go b/queue/bytes_queue_test.go index 9e408505..48b08538 100644 --- a/queue/bytes_queue_test.go +++ b/queue/bytes_queue_test.go @@ -369,11 +369,7 @@ func get(queue *BytesQueue, index int) []byte { } func blob(char byte, len int) []byte { - b := make([]byte, len) - for index := range b { - b[index] = char - } - return b + return bytes.Repeat([]byte{char}, len) } func assertEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) {