@@ -17,6 +17,7 @@ package cobra2snooty
17
17
import (
18
18
"bytes"
19
19
"fmt"
20
+ "io"
20
21
"os"
21
22
"path/filepath"
22
23
"strings"
@@ -317,9 +318,9 @@ func TestGenDocsSnapshots(t *testing.T) {
317
318
WithCustomTimeGetter (func () time.Time {
318
319
return time .Date (2025 , 3 , 5 , 17 , 0 , 0 , 0 , time .UTC )
319
320
}),
320
- WithCustomExampleFormatter (func (buf * bytes. Buffer , cmd * cobra.Command ) {
321
- _ , _ = fmt .Fprintf (buf , "custom example for %s\n " , cmd .Use )
322
- _ , _ = buf . WriteString ( cmd .Example )
321
+ WithCustomExampleFormatter (func (w io. Writer , cmd * cobra.Command ) {
322
+ _ , _ = fmt .Fprintf (w , "custom example for %s\n " , cmd .Use )
323
+ _ , _ = w . Write ([] byte ( cmd .Example ) )
323
324
}),
324
325
},
325
326
},
@@ -334,10 +335,10 @@ func TestGenDocsSnapshots(t *testing.T) {
334
335
WithCustomTimeGetter (func () time.Time {
335
336
return time .Date (2025 , 3 , 5 , 17 , 0 , 0 , 0 , time .UTC )
336
337
}),
337
- WithCustomExampleFormatter (func (buf * bytes. Buffer , cmd * cobra.Command ) {
338
- _ , _ = buf . WriteString ( "-- before example --\n " )
339
- DefaultExampleFormatter (buf , cmd )
340
- _ , _ = buf . WriteString ( "-- after example --\n " )
338
+ WithCustomExampleFormatter (func (w io. Writer , cmd * cobra.Command ) {
339
+ _ , _ = w . Write ([] byte ( "-- before example --\n " ) )
340
+ DefaultExampleFormatter (w , cmd )
341
+ _ , _ = w . Write ([] byte ( "-- after example --\n " ) )
341
342
}),
342
343
},
343
344
},
0 commit comments