On Tue, Feb 6, 2024 at 12:18 PM 'Brian Candler' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> The C functions are mainly there to prevent overrunning already-allocated 
> buffers, which isn't an issue with Go.
Thanks! In addition to that, It also helps with code with upper limit
memory-requirement, which fmt.Sprintf() can't.
Though I can live with careful coding and not using Sprintf() in this
case, I just hoped possibly somebody else already thought about
needing that.

...
> You could make a custom type which implements io.Writer and truncates at a 
> given size, and pass it to fmt.Fprintf
IIUC this sounds similar to what I'm asking for. How to use a limiting
io.Writer with fmt.Sprintf()? How would this limit fmt.Sprintf()'s
memory usage?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bctqro%3D9St0Qj_A-UGEUowvjK1OHX%3DQJ2QiBAMQdxZBwvHM%2Bw%40mail.gmail.com.

Reply via email to