@cryptotaxi247 / kubo / commits / 69e92f939

util

Juan Batiz-Benet committed Jul 5, 2014 at 01:56 UTC 69e92f939c6a482afd3c414595297bf3e69fb2aa
1 file changed +30
util/util.go new
+30
@@ -0,0 +1,30 @@
1 +package data
2 +
3 +import (
4 + "fmt"
5 + "os"
6 +)
7 +
8 +var Debug bool
9 +var NotImplementedError = fmt.Errorf("Error: not implemented yet.")
10 +
11 +// Shorthand printing functions.
12 +func PErr(format string, a ...interface{}) {
13 + fmt.Fprintf(os.Stderr, format, a...)
14 +}
15 +
16 +func POut(format string, a ...interface{}) {
17 + fmt.Fprintf(os.Stdout, format, a...)
18 +}
19 +
20 +func DErr(format string, a ...interface{}) {
21 + if Debug {
22 + PErr(format, a...)
23 + }
24 +}
25 +
26 +func DOut(format string, a ...interface{}) {
27 + if Debug {
28 + POut(format, a...)
29 + }
30 +}