Imports #
_ "embed"
"go/ast"
"go/token"
"go/types"
"regexp"
"strings"
"unicode"
"unicode/utf8"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
_ "embed"
"go/ast"
"go/token"
"go/types"
"regexp"
"strings"
"unicode"
"unicode/utf8"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
var Analyzer = *ast.UnaryExpr
var acceptedFuzzTypes = []types.Type{...}
go:embed doc.go
var doc string
This pattern is taken from /go/src/go/doc/example.go
var outputRe = *ast.CallExpr
type commentMetadata struct {
isOutput bool
pos token.Pos
}
type tokenRange struct {
p token.Pos
e token.Pos
}
func (r tokenRange) End() token.Pos
func (r tokenRange) Pos() token.Pos
checkAddCalls checks that the arguments of f.Add calls have the same number and type of arguments as the signature of the function passed to (*testing.F).Fuzz
func checkAddCalls(pass *analysis.Pass, fn *ast.FuncDecl, params *types.Tuple)
func checkExampleName(pass *analysis.Pass, fn *ast.FuncDecl)
func checkExampleOutput(pass *analysis.Pass, fn *ast.FuncDecl, fileComments []*ast.CommentGroup)
checkFuzz checks the contents of a fuzz function.
func checkFuzz(pass *analysis.Pass, fn *ast.FuncDecl)
checkFuzzCall checks the arguments of f.Fuzz() calls: 1. f.Fuzz() should call a function and it should be of type (*testing.F).Fuzz(). 2. The called function in f.Fuzz(func(){}) should not return result. 3. First argument of func() should be of type *testing.T 4. Second argument onwards should be of type []byte, string, bool, byte, rune, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64 5. func() must not call any *F methods, e.g. (*F).Log, (*F).Error, (*F).Skip The only *F methods that are allowed in the (*F).Fuzz function are (*F).Failed and (*F).Name. Returns the list of parameters to the fuzz function, if they are valid fuzz parameters.
func checkFuzzCall(pass *analysis.Pass, fn *ast.FuncDecl) (params *types.Tuple)
func checkTest(pass *analysis.Pass, fn *ast.FuncDecl, prefix string)
func formatAcceptedFuzzType() string
Validate that fuzz target function's arguments are of accepted types.
func isAcceptedFuzzType(paramType types.Type) bool
func isExampleSuffix(s string) bool
isFuzzTargetDot reports whether call is (*testing.F).
func isFuzzTargetDot(pass *analysis.Pass, call *ast.CallExpr, name string) bool
isFuzzTargetDotAdd reports whether call is (*testing.F).Add().
func isFuzzTargetDotAdd(pass *analysis.Pass, call *ast.CallExpr) bool
isFuzzTargetDotFuzz reports whether call is (*testing.F).Fuzz().
func isFuzzTargetDotFuzz(pass *analysis.Pass, call *ast.CallExpr) bool
func isTestParam(typ ast.Expr, wantType string) bool
func isTestSuffix(name string) bool
func isTestingType(typ types.Type, testingType string) bool
func lookup(pkg *types.Package, name string) []types.Object
func run(pass *analysis.Pass) (interface{}, error)
Validate the arguments of fuzz target.
func validateFuzzArgs(pass *analysis.Pass, params *types.Tuple, expr ast.Expr) bool
Generated with Arrow