Simplify exported spew functions by using 'ConfigState' methods

This commit is contained in:
Harald Nordgren 2019-01-19 10:02:46 +01:00
parent d8f796af33
commit 9f622107f2
1 changed files with 3 additions and 6 deletions

View File

@ -21,7 +21,6 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io" "io"
"os"
"reflect" "reflect"
"regexp" "regexp"
"strconv" "strconv"
@ -470,15 +469,13 @@ func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
// Fdump formats and displays the passed arguments to io.Writer w. It formats // Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump. // exactly the same as Dump.
func Fdump(w io.Writer, a ...interface{}) { func Fdump(w io.Writer, a ...interface{}) {
fdump(&Config, w, a...) Config.Fdump(w, a...)
} }
// Sdump returns a string with the passed arguments formatted exactly the same // Sdump returns a string with the passed arguments formatted exactly the same
// as Dump. // as Dump.
func Sdump(a ...interface{}) string { func Sdump(a ...interface{}) string {
var buf bytes.Buffer return Config.Sdump(a...)
fdump(&Config, &buf, a...)
return buf.String()
} }
/* /*
@ -505,5 +502,5 @@ 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...) Config.Dump(a...)
} }