Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.09 KB

readme.md

File metadata and controls

55 lines (36 loc) · 1.09 KB

XGo/dump

Quick Look

aInt := 1
bStr := `sf`
cMap := map[string]interface{}{"name": "z", "age": 14}
dArray := []interface{}{&cMap, aInt, bStr}

dump.Dump(aInt, &aInt, &bStr, bStr, cMap, dArray, cMap["name"], dArray[2], dArray[aInt])

Option

custom options

// disable dump in global, default false means enable
// disable it in production to ignore the unnecessary output and risks
dump.Disable = false

// show variant line in head
dump.ShowFileLine1 = true

// change writer in global
dump.DefaultWriter = os.Stdout

// only show the first-n elements
// others will show as '...'
// * these options is design for debug clearly
dump.MaxSliceLen = 32
dump.MaxMapLen   = 32

// serialize options

// render map with sorted keys
dump.OptSortMapKeys = true

// render []uint8(`ab`) as string("ab")
OptShowUint8sAsString = true

// render uint8(97) as char('a')
OptShowUint8AsChar

More TestCases

https://github.com/Kretech/xgo/blob/master/dump/dumper_test.go

https://github.com/Kretech/xgo/blob/master/dump/serialize_test.go