Skip to content

pretty print all of [array, slice, struct, map ...]

Notifications You must be signed in to change notification settings

dugei/pretty-print

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pretty-print

pretty print all of [array, slice, struct, map ...]

  type Student struct {
      Name string
      Age int
      Addr address
  }


  type address struct {
      street string
      no string
  }

  func main() {

      v := map[string]interface{}{
          "str":   "foo",
          "num":   100,
          "bool":  false,
          "null":  nil,
          "array": []string{"foo", "bar", "baz"},
          "map": map[string]interface{}{
              "foo": "bar",
          },
      }

      a := address{"长安街", "18"}
      s := Student{"张三", 30, a}
      v["info"] = s

      prettyprint.P(v)
  }

About

pretty print all of [array, slice, struct, map ...]

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages