3 ms·
This is bit nitpicking, but in Go comments are usually done with two slashes followed by a space. See this for example: http://golang.org/src/pkg/bytes/buffer.g
by Jhsto 12y ago
This is bit nitpicking, but in Go comments are usually done with two slashes followed by a space. See this for example: http://golang.org/src/pkg/bytes/buffer.go http://golang.org/src/pkg/bytes/buffer.go
This is good practice in your own packages as well, as online tools such as GoDoc rely that your code is commented right.
- zerr 12y agoI wander why not start a comment text without a function name? i.e. "reads something" instead of "Read reads something". Can't GoDoc easily extract function names from the code?
- peeyek 12y agostarting comment with function name will much easier run `godoc` with `grep` command. $ godoc regexp | grep parse "If all the doc comments in the package began, "This function...", `grep` wouldn't help you remember the name. But because the package starts each doc comment with the name, you'd see something like this, which recalls the word you're looking for." Effective Go - http://golang.org/doc/effective_go.html#commentary http://golang.org/doc/effective_go.html#commentary