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.

In this video, Miki will generate documentation that displays and correctly formats testable code. In the context of this video, testable code will be code that a user can paste into their scratch file to test out the functionality of a package or API. Miki will start by adding a source code file to his package and define a test function. Within this test function, He will write the comments and syntax required to display testable code on his documentation. Watch to learn how you can generate documentation with code samples your end users can run.

Things you will learn in this video

  • How to add formatting to your Go documentation.
  • Generate testable code within documentation.

Video

Trusted by Top Technology Companies

We've built our reputation as educators and bring that mentality to every project. When you partner with us, your team will learn best practices and grow along the way.

30,000+

Engineers Trained

1,000+

Companies Worldwide

14+

Years in Business