Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To lint Go documentation in CI, install a pinned godoc-lint release and run godoclint ./... from your repository root. If your project already uses golangci-lint, enable godoclint in its v2 configuration instead; the godoc-lint project says integration is available starting with golangci-lint v2.5.0. The two routes use different configuration formats.

Choose standalone godoc-lint or golangci-lint

Route Best fit Configuration CI command
Standalone godoc-lint You want an independent check or do not already use golangci-lint. godoc-lint’s own configuration files and CLI options. godoclint ./...
golangci-lint integration Your repository already runs golangci-lint and you want one linter runner. golangci-lint v2 configuration; standalone godoc-lint settings do not apply. Your existing golangci-lint command.

The godoc-lint project describes the tool as a “fast, little opinionated linter for Go documentation practice” that is ready to use without additional configuration. See the godoc-lint project documentation for its installation and rule details.

Install and run the standalone linter

  1. Choose a release version and install it from the repository root or in your CI setup: go install github.com/godoc-lint/godoc-lint/cmd/godoclint@<version>. Replace <version> with the release tag you intend to use. Prebuilt binaries are also available through the project’s releases.

  2. Run the linter against all packages: godoclint ./.... Use a narrower Go package pattern if you only want to check part of the repository.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Add the command as a CI check so that documentation violations cause the job to fail. The project also documents go run as an alternative when you do not want to install a separate binary.

For repeatable CI, pin a deliberate godoc-lint version and update it intentionally rather than installing @latest on every run. This is reproducibility guidance, not a requirement imposed by godoc-lint.

Enable godoc-lint in golangci-lint v2

Godoc-lint is integrated into golangci-lint starting with v2.5.0, according to the godoc-lint project. Add it to the v2 linters.enable list in your golangci-lint configuration:

version: "2"
linters:
  enable:
    - godoclint

This is a configuration fragment, not a complete CI workflow. Once enabled, run the golangci-lint command your repository already uses. For available integrated options and configuration syntax, consult the golangci-lint configuration documentation; do not copy standalone godoc-lint settings into the golangci-lint configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

GitHub Actions setup order

If you use golangci/golangci-lint-action v4.0.0 or later, the action repository requires an explicit Go setup step before the linter action. Follow the action’s current instructions at the official golangci-lint GitHub Action repository. Pin action and linter versions according to your workflow’s versioning policy.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Set rule scope and exceptions

Start with the defaults, then decide how strict to be

Standalone godoc-lint looks for .godoc-lint.yaml or .godoclint.yaml in its working directory. If neither exists, it uses its defaults. Its CLI supports selecting rule sets (basic, all, or none), enabling or disabling individual rules, and including or excluding relative path patterns. Use forward slashes in path patterns for consistent behavior across platforms.

The default basic rules are:

  • pkg-doc: checks that package documentation begins with Package <NAME>, subject to documented exceptions.
  • single-pkg-doc: checks the project’s single-package-documentation convention.
  • start-with-name: checks that a symbol’s comment starts with the associated symbol name.
  • deprecated: checks the prescribed format for Deprecated: notes.

For broader coverage, godoc-lint categorizes require-doc and require-pkg-doc as stricter checks, and max-len, no-unused-link, and require-stdlib-doclink as extra rules. Consider the extra maintenance involved before applying stricter documentation requirements to an established codebase.

  • max-len checks documentation line length; its documented default is 77 characters, excluding comment delimiters.
  • no-unused-link checks Go documentation for unused link definitions.
  • require-stdlib-doclink suggests links to standard-library symbols when it can detect them.

Choose a test-file policy

Standalone rules generally skip Go test files by default, and per-rule options can include them. The project also gives a golangci-lint exclusion example for _test.go files. Decide whether test documentation belongs in your CI check and configure the selected route accordingly rather than assuming every file is in scope.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Exclude generated or legacy files deliberately

For generated or legacy files you do not plan to change, use the relevant configuration’s exclusions. Standalone godoc-lint also supports inline //godoclint:disable directives. When integrated with golangci-lint, use its //nolint:godoclint form and follow golangci-lint’s directive guidance.

Make the CI check maintainable

  • Pin the linter version. Use a chosen release so the check does not silently change when a new version appears.
  • Keep configuration with the runner it belongs to. Standalone godoc-lint uses its own configuration; integrated use follows golangci-lint’s configuration model.
  • Review file scope. Decide whether tests and generated files should be checked, excluded, or handled with directives.
  • Adopt stricter rules intentionally. Enabling requirements for every exported symbol may surface substantial documentation work in an existing library.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.