...

Package gofixdirective

import "cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/gofixdirective"
Overview
Index

Overview ▾

Package gofixdirective searches for and validates go:fix directives. The go/analysis/passes/inline package uses findgofix to perform inlining. The go/analysis/passes/gofix package uses findgofix to check for problems with go:fix directives.

gofixdirective is separate from gofix to avoid depending on refactor/inline, which is large.

func Find

func Find(pass *analysis.Pass, root inspector.Cursor, h Handler)

Find finds functions and constants annotated with an appropriate "//go:fix" comment (the syntax proposed by #32816), and calls handler methods for each one. h may be nil.

type Handler

A Handler handles language entities with go:fix directives.

type Handler interface {
    HandleFunc(*ast.FuncDecl)
    HandleAlias(*ast.TypeSpec)
    HandleConst(name, rhs *ast.Ident)
}