Golang comments

From wikinotes
Revision as of 21:07, 23 May 2022 by Will (talk | contribs)

Comments

// single line comment

/* Multiline
 * Comment
 */

Doc Comments

There is no special syntax for doc-comments.
A regular comment preceding any top-level declaration is a doc-comment.
It is customary to have a doc-comment above every exported function.

// Says hello.
// Prints hello to STDOUT.
func Hello() {
    fmt.Println("hello")
}