Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays don't round-trip #36

Open
snadrus opened this issue Jun 22, 2016 · 2 comments · May be fixed by #91
Open

Arrays don't round-trip #36

snadrus opened this issue Jun 22, 2016 · 2 comments · May be fixed by #91

Comments

@snadrus
Copy link

snadrus commented Jun 22, 2016

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"},
  }
*/

}

@kr
Copy link
Owner

kr commented 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
Copy link
Author

snadrus commented 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:

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
.

@artemklevtsov artemklevtsov linked a pull request Feb 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants