未完成的代码

This commit is contained in:
des
2026-02-26 11:37:56 +08:00
parent 657dc7c3a6
commit 2a35f2f816
2 changed files with 18 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
package tool
// Karmaforge 因果熔炉
// 这个函数会被引用,并且最终被代码生成所重写
func Karmaforge[T any](params ...any) *T {
var result T
return &result
panic("在使用因果熔炉之前,需要执行仪式")
// var result T
// return &result
}

View File

@@ -2,6 +2,7 @@ package tool
import (
"fmt"
"go/types"
"os"
"path/filepath"
"strings"
@@ -41,6 +42,18 @@ func main() {
panic(err)
}
for _, pkg := range pkgs {
top := pkg.Types.Scope()
funcs := []*types.Func{}
for _, name := range top.Names() {
obj := top.Lookup(name)
if !strings.HasSuffix(obj.Name(), "Provider") {
continue
}
fun, ok := obj.(*types.Func)
if ok {
funcs = append(funcs, fun)
}
}
fmt.Println(pkg.Name)
}
}