genbindings/util: add pretty-printer

This commit is contained in:
mappu 2024-09-04 18:07:11 +12:00
parent 7d493a67d6
commit 25e6ea1698

View File

@ -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))
}