How to create visible Go documentation?
That is easy to create documentation for any function in go like that:
package main
// documentation example
func DocumentedFunction() bool {
return true
}
And i can see that documentation when i call that function:
Can i write package documentation, that will be visible from editor/IDE? Do i have to install additional tools to achieve similar behaviour for package documentation?
CodePudding user response:
According to the official Go documentation and this link, it should be possible to create documentation for an entire package the same way you would do it for a function:
To document a function, type, constant, variable, or even a complete package, write a regular comment directly preceding its declaration, with no blank line in between.
For example: the strings package:
// Package strings implements simple functions to manipulate UTF-8 encoded strings.
//
// For information about UTF-8 strings in Go, see https://blog.golang.org/strings.
package strings
..
..
rest of the file
So you basically just add a normal comment above the package
keyword.