example_test.go 306 B

1234567891011121314151617181920
  1. package pretty_test
  2. import (
  3. "fmt"
  4. "github.com/kr/pretty"
  5. )
  6. func Example() {
  7. type myType struct {
  8. a, b int
  9. }
  10. var x = []myType{{1, 2}, {3, 4}, {5, 6}}
  11. fmt.Printf("%# v", pretty.Formatter(x))
  12. // output:
  13. // []pretty_test.myType{
  14. // {a:1, b:2},
  15. // {a:3, b:4},
  16. // {a:5, b:6},
  17. // }
  18. }