.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / analysis / facts / token.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/analysis/facts/token.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/analysis/facts/token.go
new file mode 100644 (file)
index 0000000..26e76ff
--- /dev/null
@@ -0,0 +1,24 @@
+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{}),
+}