vikunja/vendor/honnef.co/go/tools/facts/token.go
renovate def2362682
All checks were successful
continuous-integration/drone/push Build is passing
Update module spf13/viper to v1.7.0 (#494)
Update module spf13/viper to v1.7.0

Reviewed-on: vikunja/api#494
2020-05-09 13:44:17 +00:00

25 lines
502 B
Go

package facts
import (
"go/ast"
"go/token"
"reflect"
"golang.org/x/tools/go/analysis"
)
var TokenFile = &analysis.Analyzer{
Name: "tokenfileanalyzer",
Doc: "creates a mapping of *token.File to *ast.File",
Run: func(pass *analysis.Pass) (interface{}, error) {
m := map[*token.File]*ast.File{}
for _, af := range pass.Files {
tf := pass.Fset.File(af.Pos())
m[tf] = af
}
return m, nil
},
RunDespiteErrors: true,
ResultType: reflect.TypeOf(map[*token.File]*ast.File{}),
}