Merge pull request #111450 from HecarimV/fix-22072710

cleanup: omit redundant arguments in make call
This commit is contained in:
Kubernetes Prow Robot 2022-07-29 19:29:52 -07:00 committed by GitHub
commit f6e163fe27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -654,7 +654,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
copy(out[1:], q.s)
return out, nil
}
result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
result := make([]byte, int64QuantityExpectedBytes)
result[0] = '"'
number, suffix := q.CanonicalizeBytes(result[1:1])
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into

View File

@ -165,7 +165,7 @@ func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s
if exponent == 0 {
return nil, true
}
result := make([]byte, 8, 8)
result := make([]byte, 8)
result[0] = 'e'
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
if &result[1] == &number[0] {

View File

@ -60,7 +60,7 @@ func (a *Allocator) Allocate(n uint64) []byte {
}
// grow the buffer
size := uint64(2*cap(a.buf)) + n
a.buf = make([]byte, size, size)
a.buf = make([]byte, size)
a.buf = a.buf[:n]
return a.buf
}
@ -72,5 +72,5 @@ type SimpleAllocator struct{}
var _ MemoryAllocator = &SimpleAllocator{}
func (sa *SimpleAllocator) Allocate(n uint64) []byte {
return make([]byte, n, n)
return make([]byte, n)
}

View File

@ -174,7 +174,7 @@ type testAllocator struct {
}
func (ta *testAllocator) Allocate(n uint64) []byte {
ta.buf = make([]byte, n, n)
ta.buf = make([]byte, n)
ta.allocateCount++
return ta.buf
}