Skip to content

Comments

// single-line comment

var myVar int // comment at the end of a line

/*
multiple line comment
*/

Documenting a package follows an expected documentation using comments, the first line begins with Package plus the package name:

// Package settings provides variables which can be 
// provided via environment variables.
package settings

import "strings"

Comments are also expected prior to any public entity, that is things that start with a capital letter:

// Package settings provides variables which can be 
// provided via environment variables.
package settings

import "strings"

// Pi is a mathematical constant that is the ratio of a circle's circumference to its diameter
const Pi float32 = 3.141