Go’s best-kept secret: executable examples

https://bitfieldconsulting.com/golang/examples

21 points · 5 comments · view on lemmy.world

5 Comments

otl@lemmy.sdf.org · 5 pts · 3y

There's also Testable Examples in Go from the official Go blog.

morgen@infosec.pub · 4 pts · 3y (3 replies)

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?

otl@lemmy.sdf.org · 2 pts · 3y

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).

RandomDevOpsDude@programming.dev · 2 pts · 3y

ExampleEcho

going to

func Echo doc Example

(and many more)

austin@programming.dev · 1 pts · 3y

The go stdlib uses it a lot. For example, the strings package