github.com/bingoohuang/gg@v0.0.0-20240325092523-45da7dee9335/pkg/dump/README.md (about) 1 # Dump 2 3 `goutil/dump` is a golang data printing toolkit that prints beautiful and easy to read go slice, map, struct data 4 5 - Github: https://github.com/gookit/goutil/dump 6 - GoDoc: https://pkg.go.dev/github.com/gookit/goutil/dump 7 8 ## Install 9 10 ```bash 11 go get github.com/gookit/goutil/dump 12 ``` 13 14 ## Usage 15 16 run demo: `go run ./dump/_examples/demo1.go` 17 18 ```go 19 package main 20 21 import "github.com/gookit/goutil/dump" 22 23 // rum demo: go run ./dump/_examples/demo1.go 24 func main() { 25 otherFunc1() 26 } 27 28 func otherFunc1() { 29 dump.P( 30 23, 31 []string{"ab", "cd"}, 32 []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, // len > 10 33 map[string]interface{}{ 34 "key": "val", "sub": map[string]string{"k": "v"}, 35 }, 36 struct { 37 ab string 38 Cd int 39 }{ 40 "ab", 23, 41 }, 42 ) 43 } 44 ``` 45 46 You will see: 47 48  49 50 ## More preview 51 52 - nested struct 53 54  55 56 57 ## Functions 58 59 ```go 60 func P(vs ...interface{}) 61 func V(vs ...interface{}) 62 func Print(vs ...interface{}) 63 ``` 64 65 ## Related 66 67 - https://github.com/kr/pretty 68 - https://github.com/davecgh/go-spew More detail for kr/pretty 69 - https://github.com/kortschak/utter It's forks