8000
package main
import ( "fmt" "github.com/kr/pretty" )
type Foo struct { S []string }
func main() { actual := Foo{ S: []string{"a", "b", "c"}, }
fmt.Println(pretty.Sprint(actual)) /* Prints: main.Foo{ S: {"a", "b", "c"}, } */ // Would error: /* result := Foo{ S: {"a", "b", "c"}, } */
}
The output of this package is for humans, not compilers.
I admit, this purpose isn't clearly stated anywhere. I consider this a documentation bug.
I've been using this package to print complex objects, visually verify them, and copy-paste them into a unit test as an expected result.
Would you accept a PR for this, or should I fork the repo for my needs? On Jun 22, 2016 3:21 PM, "Keith Rarick" notifications@github.com wrote:
The output of this package is for humans, not compilers. I admit, this purpose isn't clearly stated anywhere. I consider this a documentation bug. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub #36 (comment), or mute the thread https://github.com/notifications/unsubscribe/AB1OLsPK7E1kRoPi4NftgQbAo-Y_pnWYks5qObVTgaJpZM4I8QXL .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub #36 (comment), or mute the thread https://github.com/notifications/unsubscribe/AB1OLsPK7E1kRoPi4NftgQbAo-Y_pnWYks5qObVTgaJpZM4I8QXL .
Activity
kr commentedon Jun 22, 2016
The output of this package is for humans, not compilers.
I admit, this purpose isn't clearly stated anywhere. I consider this a documentation bug.
snadrus commentedon Jun 23, 2016
I've been using this package to print complex objects, visually verify
them, and copy-paste them into a unit test as an expected result.
Would you accept a PR for this, or should I fork the repo for my needs?
On Jun 22, 2016 3:21 PM, "Keith Rarick" notifications@github.com wrote: