blob: b5339937d72d853a8ca7d6f8642f53496ca237fb [file] [log] [blame] [view]
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11001# Comments
2
3Every package should have a package comment. It should immediately precede the ` package ` statement in one of the files in the package. (It only needs to appear in one file.) It should begin with a single sentence that begins "Package _packagename_" and give a concise summary of the package functionality. This introductory sentence will be used in godoc's list of all packages.
4
5Subsequent sentences and/or paragraphs can give more details. Sentences should be properly punctuated.
6
nathany814c2192014-12-10 22:02:06 -08007```go
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11008// Package superman implements methods for saving the world.
9//
10// Experience has shown that a small number of procedures can prove
11// helpful when attempting to save the world.
12package superman
13```
14
15Nearly every top-level type, const, var and func should have a comment. A comment for bar should be in the form "_bar_ floats on high o'er vales and hills.". The first letter of _bar_ should not be capitalized unless it's capitalized in the code.
16
nathany814c2192014-12-10 22:02:06 -080017```go
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110018// enterOrbit causes Superman to fly into low Earth orbit, a position
19// that presents several possibilities for planet salvation.
20func enterOrbit() os.Error {
21 ...
22}
23```