mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 14:18:37 +00:00
genbindings/util: add pretty-printer
This commit is contained in:
parent
7d493a67d6
commit
25e6ea1698
@ -1,7 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,3 +18,12 @@ func maybeSuffix(counter int) string {
|
|||||||
func titleCase(s string) string {
|
func titleCase(s string) string {
|
||||||
return strings.ToUpper(s[0:1]) + s[1:]
|
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