Skip to content

Commit

Permalink
Use bytes.Repeat instead of for loop (#202)
Browse files Browse the repository at this point in the history
It looks like we reimplemented bytes.Repeat functionality with
blob function. Lets use as much code from stdlib as possible.
  • Loading branch information
janisz authored and cristaloleg committed Jan 28, 2020
1 parent 7090562 commit fcb069f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bigcache_test.go
Expand Up @@ -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)
}
6 changes: 1 addition & 5 deletions queue/bytes_queue_test.go
Expand Up @@ -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{}) {
Expand Down

0 comments on commit fcb069f

Please sign in to comment.