chore: update the result of CR (#2354)

* chore: update the result of CR

* Update utils.go

* Update utils.go

* Update context.go

* Update context.go
This commit is contained in:
thinkerou
2020-05-04 11:40:41 +08:00
committed by GitHub
parent abc4fa0718
commit 54175dbe72
6 changed files with 16 additions and 10 deletions
+4 -3
View File
@@ -136,10 +136,11 @@ func bufApp(buf *[]byte, s string, w int, c byte) {
// Otherwise use either the stack buffer, if it is large enough, or
// allocate a new buffer on the heap, and copy all previous characters.
if l := len(s); l > cap(b) {
*buf = make([]byte, len(s))
length := len(s)
if length > cap(b) {
*buf = make([]byte, length)
} else {
*buf = (*buf)[:l]
*buf = (*buf)[:length]
}
b = *buf