Or use log instead of fmt var stdout = log.New(os.Stdout, "", 0)
Then you can easily redirect it to any io.Writter like buf := &strings.Builder{} stdout = log.New(buf, "", 0) On Sunday, 6 May 2018 13:32:47 UTC+8, Lars Seipel wrote: > > On Sat, May 05, 2018 at 08:55:17AM -0700, mfried...@gmail.com > <javascript:> wrote: > > * Now in golang `os.Stdout` is an `*os.File` which is mostly a wrapper > for > > an OS specific file. > > You can always use os.Pipe to get an actual file descriptor to write to. > -- 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. For more options, visit https://groups.google.com/d/optout.