diff --git a/cmd/zire/main.go b/cmd/zire/main.go index 31705cb..c41155f 100644 --- a/cmd/zire/main.go +++ b/cmd/zire/main.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "regexp" "zire/internal/tools" "golang.org/x/tools/go/packages" @@ -24,8 +25,18 @@ func main() { pkgs, err := packages.Load(cfg, "./...") tools.Check(err, "加载包失败") for _, pkg := range pkgs { + fmt.Println("当前包") fmt.Println(pkg.Name) - fmt.Println(pkg.TypesInfo.Scopes) + scope := pkg.Types.Scope() + reg := regexp.MustCompile(".Provider") + fmt.Println("寻找提供者") + for _, name := range scope.Names() { + if !reg.MatchString(name) { + continue + } + fmt.Println(name) + } + break } }