make "Dump" stdoutput atomic (non-interleaved)

This commit is contained in:
tg 2019-07-17 12:54:42 +03:00
parent d8f796af33
commit 1b004c6600
2 changed files with 6 additions and 4 deletions

View File

@ -20,7 +20,6 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"os"
) )
// ConfigState houses the configuration options used by spew to format and // ConfigState houses the configuration options used by spew to format and
@ -271,7 +270,9 @@ See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string. get the formatted result as a string.
*/ */
func (c *ConfigState) Dump(a ...interface{}) { func (c *ConfigState) Dump(a ...interface{}) {
fdump(c, os.Stdout, a...) var buf bytes.Buffer
fdump(c, &buf, a...)
fmt.Print(buf.String())
} }
// Sdump returns a string with the passed arguments formatted exactly the same // Sdump returns a string with the passed arguments formatted exactly the same

View File

@ -21,7 +21,6 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io" "io"
"os"
"reflect" "reflect"
"regexp" "regexp"
"strconv" "strconv"
@ -505,5 +504,7 @@ See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string. get the formatted result as a string.
*/ */
func Dump(a ...interface{}) { func Dump(a ...interface{}) {
fdump(&Config, os.Stdout, a...) var buf bytes.Buffer
fdump(&Config, &buf, a...)
fmt.Print(buf.String())
} }