【文件属性】:
文件名称:astgen-go:interface {} => ast.Node
文件大小:10KB
文件格式:ZIP
更新时间:2021-02-14 05:59:55
golang golang-library Go
astgen-go
从Go中的任意值构建Go代码。
用法
package main
import (
"go/printer"
"go/token"
"log"
"os"
"github.com/itchyny/astgen-go"
)
type X struct {
x int
y Y
z * Z
}
type Y struct {
y int
}
type Z struct {
s string
t map [ string ] int
}
func main () {
x := & X { 1 , Y { 2 }, & Z { "hello" , map [ string ] int { "x" : 42 }}}
t , err := astgen . Build ( x )
if err != nil {
log . Fatal ( err )
【文件预览】:
astgen-go-master
----go.mod(45B)
----.github()
--------workflows()
----type.go(2KB)
----is_zero.go(971B)
----LICENSE(1KB)
----README.md(1KB)
----Makefile(289B)
----build_example_test.go(537B)
----build_test.go(9KB)
----build.go(8KB)