github.com/chunqian/pretty@v0.0.0-20200305075802-e57086a8d0c4/pretty-test/sample.go (about)

     1  package main
     2  
     3  import "github.com/chunqian/pretty"
     4  
     5  func main() {
     6  	greeting := "hello world"
     7  	pi := 3.14159265359
     8  	cidrs := []string{"10.0.0.0/16", "172.16.0.0/20", "192.168.0.0/24"}
     9  
    10  	type Bar struct {
    11  		Baz string
    12  	}
    13  
    14  	type Foo struct {
    15  		a string
    16  		b Bar
    17  		c int
    18  	}
    19  
    20  	mt := Foo{
    21  		a: "look how pretty this is!",
    22  		b: Bar{
    23  			Baz: "it follow pointers too",
    24  		},
    25  		c: 123,
    26  	}
    27  	fc := func(n float64) bool {
    28  		if n < 1 {
    29  			return true
    30  		}
    31  		return false
    32  	}
    33  	mp := map[string]interface{}{
    34  		"a": 1,
    35  		"b": 2,
    36  		"c": 3,
    37  		"d": mt,
    38  	}
    39  	pretty.Println(greeting, cidrs, cidrs[1:3], mt, fc(pi), mp)
    40  }