Move code generator into its own package.
This commit is contained in:
parent
33821928c9
commit
2f95327892
|
@ -11,6 +11,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"gitlab.wow.st/gmp/persist/generate"
|
||||||
)
|
)
|
||||||
|
|
||||||
type visitor struct{}
|
type visitor struct{}
|
||||||
|
@ -133,7 +135,7 @@ func main() {
|
||||||
if len(ts) == 0 {
|
if len(ts) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
g := NewGenerator(pkg.Name)
|
g := generate.NewGenerator(pkg.Name)
|
||||||
for _,v := range ts {
|
for _,v := range ts {
|
||||||
g.Add(v.fun, v.name, v.typ)
|
g.Add(v.fun, v.name, v.typ)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package generate
|
||||||
const template string = `//Generated by gitlab.wow.st/persist/cmd/pgen.
|
const template string = `//Generated by gitlab.wow.st/persist/cmd/pgen.
|
||||||
//Do not edit
|
//Do not edit
|
||||||
package main
|
package main
|
Loading…
Reference in New Issue
Block a user