| name | lang-go |
| description | Use when writing, auditing, or generating documentation for Go projects — covers docstring conventions, API doc extraction, and Go-specific patterns. |
Go Language Adapter
Public API Detection
Go uses capitalization as the visibility mechanism. A symbol is public (exported) if:
- Its name starts with an uppercase letter
- It is defined at package level (not inside a function)
| Pattern | Public? |
|---|
func ProcessData( | Yes (uppercase P) |
func processData( | No (lowercase p) |
type Config struct | Yes |
type config struct | No |
var MaxRetries = | Yes |
const DefaultTimeout = | Yes |
Symbol Types to Document
| Type | Detection | Documentation Expected |
|---|
| Functions | func Name( at package level | Godoc comment starting with function name |
| Methods | func (r *Receiver) Name( | Godoc comment starting with method name |
| Types | type Name struct/interface | Godoc comment starting with type name |
| Constants | const Name = (exported) | Godoc comment or inline comment |
| Variables | var Name = (exported) | Godoc comment |
| Package | package name | Package comment in doc.go or any file |
Godoc Format
Go documentation comments must:
- Start with the symbol name
- Be a complete sentence
- Appear directly above the declaration (no blank line between)
func ProcessData(r io.Reader) ([]Result, error) {
Package Documentation
package auth
Prefer doc.go for package-level documentation.
Documentation Completeness Check
A Go symbol is fully documented when:
- Has a comment directly above it (no blank line gap)
- Comment starts with the symbol's name
- Comment is a complete sentence (ends with period)
- For functions: parameters and return values are described in the prose
Special Cases
internal/ packages: exclude from public API coverage (they are internal)
_test.go files: exclude (test code)
generated files (containing // Code generated): exclude
- Interface methods: each method should have a comment
File Patterns
Source files: **/*.go
Exclude: vendor/, *_test.go, files with // Code generated header