mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
genbindings/util: add pretty-printer
This commit is contained in:
parent
7d493a67d6
commit
25e6ea1698
@ -1,7 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -16,3 +18,12 @@ func maybeSuffix(counter int) string {
|
||||
func titleCase(s string) string {
|
||||
return strings.ToUpper(s[0:1]) + s[1:]
|
||||
}
|
||||
|
||||
func prettyPrint(obj interface{}) {
|
||||
jb, err := json.MarshalIndent(obj, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Println(string(jb))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user