lintdsl

package
v0.0.0-...-6b646bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package lintdsl provides helpers for implementing static analysis checks. Dot-importing this package is encouraged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolConst

func BoolConst(j *lint.Job, expr ast.Expr) bool

func CallName

func CallName(call *ssa.CallCommon) string

func CallNameAST

func CallNameAST(j *lint.Job, call *ast.CallExpr) string

func Dereference

func Dereference(T types.Type) types.Type

Dereference returns a pointer's element type; otherwise it returns T.

func DereferenceR

func DereferenceR(T types.Type) types.Type

DereferenceR returns a pointer's element type; otherwise it returns T. If the element type is itself a pointer, DereferenceR will be applied recursively.

func ExprToInt

func ExprToInt(j *lint.Job, expr ast.Expr) (int64, bool)

func ExprToString

func ExprToString(j *lint.Job, expr ast.Expr) (string, bool)

func FilterDebug

func FilterDebug(instr []ssa.Instruction) []ssa.Instruction

func GroupSpecs

func GroupSpecs(fset *token.FileSet, specs []ast.Spec) [][]ast.Spec

func Inspect

func Inspect(node ast.Node, fn func(node ast.Node) bool)

func IsBlank

func IsBlank(id ast.Expr) bool

isBlank returns whether id is the blank identifier "_". If id == nil, the answer is false.

func IsBoolConst

func IsBoolConst(j *lint.Job, expr ast.Expr) bool

func IsCallTo

func IsCallTo(call *ssa.CallCommon, name string) bool

func IsCallToAST

func IsCallToAST(j *lint.Job, node ast.Node, name string) bool

func IsCallToAnyAST

func IsCallToAnyAST(j *lint.Job, node ast.Node, names ...string) bool

func IsExample

func IsExample(fn *ssa.Function) bool

func IsGenerated

func IsGenerated(f *ast.File) bool

func IsGoVersion

func IsGoVersion(j *lint.Job, minor int) bool

func IsIdent

func IsIdent(expr ast.Expr, ident string) bool

func IsInMain

func IsInMain(j *lint.Job, node lint.Positioner) bool

func IsInTest

func IsInTest(j *lint.Job, node lint.Positioner) bool

func IsIntLiteral

func IsIntLiteral(expr ast.Expr, literal string) bool

func IsNil

func IsNil(j *lint.Job, expr ast.Expr) bool

func IsObject

func IsObject(obj types.Object, name string) bool

func IsOfType

func IsOfType(j *lint.Job, expr ast.Expr, name string) bool

func IsPointerLike

func IsPointerLike(T types.Type) bool

func IsType

func IsType(T types.Type, name string) bool

func IsZero deprecated

func IsZero(expr ast.Expr) bool

Deprecated: use IsIntLiteral instead

func Preamble

func Preamble(f *ast.File) string

func Render

func Render(j *lint.Job, x interface{}) string

func RenderArgs

func RenderArgs(j *lint.Job, args []ast.Expr) string

func SelectorName

func SelectorName(j *lint.Job, expr *ast.SelectorExpr) string

Types

type Field

type Field struct {
	Var  *types.Var
	Tag  string
	Path []int
}

func FlattenFields

func FlattenFields(T *types.Struct) []Field

FlattenFields recursively flattens T and embedded structs, returning a list of fields. If multiple fields with the same name exist, all will be returned.

Jump to

Keyboard shortcuts

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