-
Notifications
You must be signed in to change notification settings - Fork 1
Pretty printing for Go values
License
JekaMas/pretty
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
package pretty import "github.com/kr/pretty" Package pretty provides pretty-printing for Go values. Documentation http://godoc.org/github.com/kr/pretty Example: ``` package main import ( "bytes" "fmt" "github.com/JekaMas/pretty" ) func logDiff(obtained, expected interface{}) { var failMessage bytes.Buffer diffs := pretty.Diff(obtained, expected) if len(diffs) > 0 { failMessage.WriteString("Obtained:\t\tExpected:") for _, singleDiff := range diffs { failMessage.WriteString(fmt.Sprintf("\n%v", singleDiff)) } } fmt.Printf("... %s", failMessage.String()) } func main() { v1 := []int{0, 1, 2, 3} v2 := []int{0, 1, 4} logDiff(v1, v2) } ```
About
Pretty printing for Go values
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Go 100.0%