package main import ( "log" "regexp" "testing" _ "github.com/go-sql-driver/mysql" ) func TestXMain(t *testing.T) { a := " FsAddress *FsAddressModel // fs_address 用户地址表" re := regexp.MustCompile(`([A-Za-z0-9_]+) [^/]+ // ([^ ]+) (.+)$`) for _, line := range re.FindStringSubmatch(a) { log.Println(line) } log.Println(re.FindStringSubmatch(a)) // testGenDir = "../" + testGenDir // GenAllModels(testGenDir, TableNameComment{ // Name: "FsFont", // Comment: "测试", // }) // Now you can use the generated GORM model to interact with the database }