Use GoString instead of String
Open
reporter
- Dominant language
- Go
- Stars
- 4.7k
- Forks
- 243
- PR merge metrics
- No merged PRs in 30d
Description
cmp's diff output is mostly valid Go and so can be nicely used to fill in the `want` part of a test by running the test with an empty `want` and then copying from cmp's diff output.
However when cmp is printing, for example, two different time.Time values, it uses the formatting as returned by the String() method. I think it would be more useful, or should be an option, it if used the GoString() method instead. GoString() is supposed to return valid Go code, which would fit into the existing output style of cmp. For time.Time, it returns Go code to create that time value, which is more useful than the string format of the value.
Contributor guide
Assessment
This issue has not been assessed yet.