Go’s best-kept secret: executable examples
https://bitfieldconsulting.com/golang/examplesOpen linkView original on programming.devSyndicated from the fediverse. Read and engage on the original instance.
View original on programming.dev
https://bitfieldconsulting.com/golang/examplesOpen linkView original on programming.dev
5 replies
There's also Testable Examples in Go from the official Go blog.
I have not seen this before. Thanks for sharing. Do you know any projects that utilize this, so I can see an example implementation of this?
The sort package in the standard library uses testable examples (source code).
ExampleEcho
going to
func Echodoc Example(and many more)
The go stdlib uses it a lot. For example, the strings package