未完成的代码
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user