...

Package directive

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

Overview ▾

Package directive defines an Analyzer that checks known Go toolchain directives.

Index ▾

Package files

directive.go

Constants

const Doc = `check Go toolchain directives such as //go:debug

This analyzer checks for problems with known Go toolchain directives
in all Go source files in a package directory, even those excluded by
//go:build constraints, and all non-Go source files too.

For //go:debug (see https://go.dev/doc/godebug), the analyzer checks
that the directives are placed only in Go source files, only above the
package comment, and only in package main or *_test.go files.

Support for other known directives may be added in the future.

This analyzer does not check //go:build, which is handled by the
buildtag analyzer.
`

Variables

var Analyzer = &analysis.Analyzer{
    Name: "directive",
    Doc:  Doc,
    URL:  "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/directive",
    Run:  runDirective,
}