make "Dump" stdoutput atomic (non-interleaved)
This commit is contained in:
parent
d8f796af33
commit
1b004c6600
|
@ -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
|
||||||
|
|
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue