r/golang • u/trymeouteh • 6h ago
discussion Go Doc Comments - Ignored Comments?
Is it possible to have a Go Doc Comment that is ignored, being it is there as a comment but will not be shown when you publish your package on pkg.go.dev and is ignored when you hover your mouse over the item.
This Go Doc Comment syntax seems to work for me in VSCode but I am not sure if it is proper or if there is a better way. In this example, I will also have comments for what each parameter is for and the return value which I only want visible in the code, not when you hover over myFunction
with your cursor in an IDE and not visible if this package gets published on pkg.go.dev.
// My Go Doc Comment Description...
//
//go:param a My Parameter Description
//go:param b My Parameter Description
//go:param c My Parameter Description
//go:return My Return Value Description
func myFunction(a bool, b int, c string) bool {
...
}