init project

This commit is contained in:
2025-03-28 17:14:57 +08:00
parent 76ca33962e
commit 4d08921f92
357 changed files with 54458 additions and 0 deletions

32
utils/ast/ast_test.go Normal file
View File

@@ -0,0 +1,32 @@
package ast
import (
"git.echol.cn/loser/xiecheng_server/global"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"os"
"path/filepath"
"testing"
)
func TestAst(t *testing.T) {
filename := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", "gva", "plugin.go")
fileSet := token.NewFileSet()
file, err := parser.ParseFile(fileSet, filename, nil, parser.ParseComments)
if err != nil {
t.Error(err)
return
}
err = ast.Print(fileSet, file)
if err != nil {
t.Error(err)
return
}
err = printer.Fprint(os.Stdout, token.NewFileSet(), file)
if err != nil {
panic(err)
}
}