• Daniel Martí's avatar
    strings: add Builder.Cap · 0566ab33
    Daniel Martí authored
    To report the capacity of the underlying buffer. The method mirrors
    bytes.Buffer.Cap.
    
    The method can be useful to know whether or not calling write or grow
    methods will result in an allocation, or to know how much memory has
    been allocated so far.
    
    Fixes #26269.
    
    Change-Id: I391db45ae825011566b594836991e28135369a78
    Reviewed-on: https://go-review.googlesource.com/122835
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    0566ab33
builder_test.go 7.37 KB