From 9263de1654f3d83f5f5d73719abe6fb450ccaa63 Mon Sep 17 00:00:00 2001 From: des <18638715007@163.com> Date: Tue, 7 Apr 2026 23:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=A7=A3=E6=9E=90=E5=8C=85?= =?UTF-8?q?=E5=86=85=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/zire/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 } }