1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/shurcooL/go-goon
2017-10-03 14:43:55 -04:00
..
bypass Vendoring 2017-10-03 14:43:55 -04:00
.travis.yml Vendoring 2017-10-03 14:43:55 -04:00
dump.go Vendoring 2017-10-03 14:43:55 -04:00
goon_test.go Vendoring 2017-10-03 14:43:55 -04:00
goon.go Vendoring 2017-10-03 14:43:55 -04:00
large_test.go Vendoring 2017-10-03 14:43:55 -04:00
print_types.go Vendoring 2017-10-03 14:43:55 -04:00
README.md Vendoring 2017-10-03 14:43:55 -04:00

goon

Build Status GoDoc

Package goon is a deep pretty printer with Go-like notation. It implements the goon specification.

Installation

go get -u github.com/shurcooL/go-goon

Examples

x := Lang{
	Name: "Go",
	Year: 2009,
	URL:  "http",
	Inner: &Inner{
		Field1: "Secret!",
	},
}

goon.Dump(x)

// Output:
// (Lang)(Lang{
// 	Name: (string)("Go"),
// 	Year: (int)(2009),
// 	URL:  (string)("http"),
// 	Inner: (*Inner)(&Inner{
// 		Field1: (string)("Secret!"),
// 		Field2: (int)(0),
// 	}),
// })
items := []int{1, 2, 3}

goon.DumpExpr(len(items))

// Output:
// len(items) = (int)(3)
adderFunc := func(a int, b int) int {
	c := a + b
	return c
}

goon.DumpExpr(adderFunc)

// Output:
// adderFunc = (func(int, int) int)(func(a int, b int) int {
// 	c := a + b
// 	return c
// })

Directories

Path Synopsis
bypass Package bypass allows bypassing reflect restrictions on accessing unexported struct fields.

Attribution

go-goon source was based on the existing source of go-spew by Dave Collins.

License