# testable examples

Published articles for testable examples.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Writing testable examples in Go

DevFeed: [Writing testable examples in Go](<https://devfeed.tech/articles/writing-testable-examples-in-go-22211.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/01/writing-testable-examples-in-go.html>)

Published: 2023-01-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [Code](<https://devfeed.tech/topics/code.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [code-comments](<https://devfeed.tech/tags/code-comments.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [examples](<https://devfeed.tech/tags/examples.md>), [generate-documentation](<https://devfeed.tech/tags/generate-documentation.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [test](<https://devfeed.tech/tags/test.md>), [testable-examples](<https://devfeed.tech/tags/testable-examples.md>), [toolchain](<https://devfeed.tech/tags/toolchain.md>)

### AI overview

This video tutorial explains how to write testable examples in Go documentation. It covers Go's documentation comments, special comment syntax for formatting, and test functions that produce code samples users can run.

### Source excerpt

Introduction Google developed Go to be an alternative to C++ with the internet and scale in mind. Go's toolchain automates tasks that are easily overlooked, and amongst those tasks is generating documentation. Go has the ability to generate documentation based on comments written in your source code. As the end user, you have the choice to view this documentation in your terminal or, if your code is publicly accessible, on pkg.go.dev. Go also offers special comment syntax to further format and style the generated documentation.