未完成的代码
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package tool
|
package tool
|
||||||
|
|
||||||
|
// Karmaforge 因果熔炉
|
||||||
|
// 这个函数会被引用,并且最终被代码生成所重写
|
||||||
func Karmaforge[T any](params ...any) *T {
|
func Karmaforge[T any](params ...any) *T {
|
||||||
var result T
|
panic("在使用因果熔炉之前,需要执行仪式")
|
||||||
return &result
|
// var result T
|
||||||
|
// return &result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package tool
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"go/types"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -41,6 +42,18 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
for _, pkg := range pkgs {
|
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)
|
fmt.Println(pkg.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user