summaryrefslogtreecommitdiff
path: root/src/lib/exvar/exvar.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exvar/exvar.go')
-rw-r--r--src/lib/exvar/exvar.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/exvar/exvar.go b/src/lib/exvar/exvar.go
index fea568337..6473f7af6 100644
--- a/src/lib/exvar/exvar.go
+++ b/src/lib/exvar/exvar.go
@@ -128,6 +128,14 @@ func (v *String) Set(value string) {
v.s = value;
}
+// IntFunc wraps a func() int64 to create a value that satisfies the Var interface.
+// The function will be called each time the Var is evaluated.
+type IntFunc func() int64;
+
+func (v IntFunc) String() string {
+ return strconv.Itoa64(v())
+}
+
// All published variables.
var vars map[string] Var = make(map[string] Var);