From 99a8b1ae8bb93565df8acbe168749278dc768979 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 4 Dec 2018 19:50:11 +1100 Subject: making a start on unidirectional data binding to fix these UI bugs --- pkg/utils/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/utils') diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index e2a5337e3..390f85f70 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,6 +1,7 @@ package utils import ( + "encoding/json" "errors" "fmt" "log" @@ -235,3 +236,8 @@ func PrevIndex(numbers []int, currentNumber int) int { } return end } + +func AsJson(i interface{}) string { + bytes, _ := json.MarshalIndent(i, "", " ") + return string(bytes) +} -- cgit v1.2.3