gox-Go语言的代码生成器 讲解 import ( "github.com/goplus/gox" ) var a , b , c * gox. Var pkg := gox . NewPkg ( "main" ) fmt , _ := pkg . Import ( "fmt" ) pkg . NewFunc ( "main" ). BodyStart ( pkg ). NewVar ( "a" , & a ). NewVar ( "b" , & b ). NewVar ( "c" , & c ). // type of variables will be auto detected VarRef ( a ). VarRef ( b ). Const ( "Hi" ). Const ( 3 ). Assign ( 2 ). EndStmt (). // a, b