记录Golang程序的惯用方式,它由一个main.go文件组成

I wrote a Go tool which reads files and produces output based on the input. It consists of one main.go file. Where do I document what the tool does, in order to make use of godoc (or just be idiomatic)?

// Should I explain it here?
package main

// Or here?
func main() {
    // code!
}

// Or somewhere else?

To document a command for godoc or godoc.org, write the command documentation in the package comment.

// Command foo does bar.
package main

func main() {
   // code!
}

See the comment in stringer.go and the stringer documentation for an example.

By default, godoc and godoc.org hide all other doc comments in a package with the name "main".