]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgo/go/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go
libgo: update to Go1.14beta1
[thirdparty/gcc.git] / libgo / go / golang.org / x / tools / go / analysis / passes / errorsas / errorsas.go
index c411466c28eb55630e12838c5d4aea12ec401753..b80271afb9515c0a111b6fe17b2825aeba2a6b37 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// The errorsas package defines an Analyzer that checks that the second arugment to
+// The errorsas package defines an Analyzer that checks that the second argument to
 // errors.As is a pointer to a type implementing error.
 package errorsas
 
@@ -16,14 +16,14 @@ import (
        "golang.org/x/tools/go/types/typeutil"
 )
 
-const doc = `report passing non-pointer or non-error values to errors.As
+const Doc = `report passing non-pointer or non-error values to errors.As
 
 The errorsas analysis reports calls to errors.As where the type
 of the second argument is not a pointer to a type implementing error.`
 
 var Analyzer = &analysis.Analyzer{
        Name:     "errorsas",
-       Doc:      doc,
+       Doc:      Doc,
        Requires: []*analysis.Analyzer{inspect.Analyzer},
        Run:      run,
 }
@@ -51,7 +51,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
                        return // not enough arguments, e.g. called with return values of another function
                }
                if fn.FullName() == "errors.As" && !pointerToInterfaceOrError(pass, call.Args[1]) {
-                       pass.Reportf(call.Pos(), "second argument to errors.As must be a pointer to an interface or a type implementing error")
+                       pass.ReportRangef(call, "second argument to errors.As must be a pointer to an interface or a type implementing error")
                }
        })
        return nil, nil