check

package
v0.0.0-...-507037c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package check ensures that Go exported symbols and the package include documentation.

Index

Constants

This section is empty.

Variables

View Source
var ErrCommentPrefix = errors.New("invalid comment prefix")

ErrCommentPrefix means the comment does not start with type name, etc.

View Source
var ErrLongComment = errors.New("long comment")

ErrLongComment means the comment line is beyond line length limit.

View Source
var ErrMultiDoc = errors.New("multiple documentation")

ErrMultiDoc means there are multiple package documentations.

View Source
var ErrMultiPackage = errors.New("multiple packages")

ErrMultiPackage means there are multiple packages at a single path.

View Source
var ErrNoDoc = errors.New("no documentation")

ErrNoDoc represents missing documentation error.

View Source
var ErrNotPackage = errors.New("not a package")

ErrNotPackage means that Go failed to parse a path.

Functions

func CheckAST

func CheckAST(fs *token.FileSet, f *ast.File) error

CheckAST scans top-level exported declarations for presence of documentation. It skips generated data.

func CheckDir

func CheckDir(path string) error

CheckDir parses a Go package at path and ensures it has documentation set.

func CheckFile

func CheckFile(fname string) error

CheckFile verifies that non-generated Go file has documentation attached to the exported declarations. It returns an error if the check fails.

func IsTest

func IsTest(name string) bool

IsTest reports whether the file is a test file. A test file has _test.go suffix.

func Run

func Run(files []string) error

Run verifies that every non-generated Go file has documentation attached to the exported declarations. It returns an error on the first failed file.

Types

type PathCollector

type PathCollector struct {
	// contains filtered or unexported fields
}

PathCollector collects unique folders from a set of files.

func NewPathCollector

func NewPathCollector() *PathCollector

NewPathCollector creates a new PathCollector.

func (*PathCollector) CollectFile

func (pc *PathCollector) CollectFile(name string)

CollectFile collects the path to the file. It skips the path if already in the collector.

func (*PathCollector) Paths

func (pc *PathCollector) Paths() []string

Paths returns a slice of collected paths.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL