summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@code.google.com>2013-08-24 08:51:15 -0400
committerKurt Jung <kurt.w.jung@code.google.com>2013-08-24 08:51:15 -0400
commit1fd34b058bc3f9408613f027fa3bb0795fdff2a6 (patch)
treef57b76e09be828b8dd16027d12d8e33d3388699f /util.go
parent80c77531940da1146401394746de38994b6c4ebc (diff)
Documentation tweaks
Diffstat (limited to 'util.go')
-rw-r--r--util.go17
1 files changed, 15 insertions, 2 deletions
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)
+}