Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use bytes.Repeat instead of for loop (allegro#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.
janisz authored and cristaloleg committed Jan 28, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent ffba9d3 commit 3f70f42
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bigcache_test.go
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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{}) {

0 comments on commit 3f70f42

Please sign in to comment.