util.go 450 B

12345678910111213141516
  1. // Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released
  2. // under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for
  3. // details. Resist intellectual serfdom - the ownership of ideas is akin to
  4. // slavery.
  5. package napping
  6. import (
  7. "encoding/json"
  8. )
  9. // pretty pretty-prints an interface using the JSON marshaler
  10. func pretty(v interface{}) string {
  11. b, _ := json.MarshalIndent(v, "", "\t")
  12. return string(b)
  13. }