Code inspect - clean ups (#8445)

This commit is contained in:
terence tsao
2021-02-12 15:04:45 -08:00
committed by GitHub
parent e2c5ae53e7
commit 068f758f49
17 changed files with 36 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -37,7 +37,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.BinaryExpr)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
expr, ok := node.(*ast.BinaryExpr)
if !ok {
return

View File

@@ -27,7 +27,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -42,7 +42,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
disallowedFns := []string{"NewSource", "New", "Seed", "Int63", "Uint32", "Uint64", "Int31", "Int",
"Int63n", "Int31n", "Intn", "Float64", "Float32", "Perm", "Shuffle", "Read"}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
switch stmt := node.(type) {
case *ast.File:
// Reset aliases (per file).

View File

@@ -63,7 +63,7 @@ func init() {
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -76,7 +76,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.AssignStmt)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
switch stmt := node.(type) {
case *ast.ExprStmt:
if call, ok := stmt.X.(*ast.CallExpr); ok {

View File

@@ -23,7 +23,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -36,7 +36,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.AssignStmt)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
if ce, ok := node.(*ast.CallExpr); ok && isPkgDot(ce.Fun, "featureconfig", "Init") {
reportForbiddenUsage(pass, ce.Pos())
return

View File

@@ -23,7 +23,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -32,7 +32,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.StructType)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
if s, ok := node.(*ast.StructType); ok {
if err := malign(node.Pos(), pass.TypesInfo.Types[s].Type.(*types.Struct)); err != nil {
pass.Reportf(node.Pos(), err.Error())

View File

@@ -26,7 +26,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -36,7 +36,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.UnaryExpr)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
switch expr := node.(type) {
case *ast.StarExpr:
unaryExpr, ok := expr.X.(*ast.UnaryExpr)

View File

@@ -33,7 +33,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -46,7 +46,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
aliases := make(map[string]string)
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
switch stmt := node.(type) {
case *ast.File:
// Reset aliases (per file).

View File

@@ -32,7 +32,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -45,7 +45,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
(*ast.ValueSpec)(nil),
}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
switch declaration := node.(type) {
case *ast.FuncDecl:
if declaration.Recv != nil {

View File

@@ -24,7 +24,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
inspect, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
inspection, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
if !ok {
return nil, errors.New("analyzer is not type *inspector.Inspector")
}
@@ -35,7 +35,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
typeInfo := types.Info{Types: make(map[ast.Expr]types.TypeAndValue)}
inspect.Preorder(nodeFilter, func(node ast.Node) {
inspection.Preorder(nodeFilter, func(node ast.Node) {
sliceExpr, ok := node.(*ast.SliceExpr)
if !ok {
return