Debian Codegraph @

internal/analysisinternal/typeindex/typeindex.go

raw
1 // Copyright 2025 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package typeindex defines an analyzer that provides a
6 // [golang.org/x/tools/internal/typesinternal/typeindex.Index].
7 //
8 // Like [golang.org/x/tools/go/analysis/passes/inspect], it is
9 // intended to be used as a helper by other analyzers; it reports no
10 // diagnostics of its own.
11 package typeindex
12
13 import (
14 "reflect"
15
16 "golang.org/x/tools/go/analysis"
17 "golang.org/x/tools/go/analysis/passes/inspect"
18 "golang.org/x/tools/go/ast/inspector"
19 "honnef.co/go/tools/internal/typesinternal/typeindex"
20 )
21
22 var Analyzer = &analysis.Analyzer{
23 Name: "typeindex",
24 Doc: "indexes of type information for later passes",
25 URL: "https://pkg.go.dev/golang.org/x/tools/internal/analysisinternal/typeindex",
26 Run: func(pass *analysis.Pass) (any, error) {
27 inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
28 return typeindex.New(inspect, pass.Pkg, pass.TypesInfo), nil
29 },
30 RunDespiteErrors: true,
31 Requires: []*analysis.Analyzer{inspect.Analyzer},
32 ResultType: reflect.TypeFor[*typeindex.Index](),
33 }