From 1fd34b058bc3f9408613f027fa3bb0795fdff2a6 Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Sat, 24 Aug 2013 08:51:15 -0400 Subject: Documentation tweaks --- util.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'util.go') diff --git a/util.go b/util.go index b2202ca..823bf68 100644 --- a/util.go +++ b/util.go @@ -20,6 +20,8 @@ import ( "bytes" "compress/zlib" "fmt" + "github.com/davecgh/go-spew/spew" + // "io/ioutil" "math" "os" "regexp" @@ -204,7 +206,7 @@ func utf8toutf16(s string) string { } // Return a if cnd is true, otherwise b -func IntIf(cnd bool, a, b int) int { +func intIf(cnd bool, a, b int) int { if cnd { return a } else { @@ -213,10 +215,21 @@ func IntIf(cnd bool, a, b int) int { } // Return aStr if cnd is true, otherwise bStr -func StrIf(cnd bool, aStr, bStr string) string { +func strIf(cnd bool, aStr, bStr string) string { if cnd { return aStr } else { return bStr } } + +// Dump the internals of the specified values +func dump(fileStr string, a ...interface{}) { + fl, err := os.OpenFile(fileStr, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) + if err == nil { + fmt.Fprintf(fl, "----------------\n") + spew.Fdump(fl, a...) + fl.Close() + } + // ioutil.WriteFile(fileStr, []byte(spew.Sdump(a)), os.ModeAppend) +} -- cgit v1.2.1-24-ge1ad