tons of code

This commit is contained in:
Egor Aristov 2025-10-25 17:55:01 +03:00
parent bfe8409c15
commit 3ef477922d
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
3 changed files with 14 additions and 4 deletions

View File

@ -9,8 +9,12 @@ import (
"text/template"
"efprojects.com/kitten-ipc/kitcom/api"
_ "embed"
)
//go:embed go_gen.tmpl
var templateString string
type goGenData struct {
PkgName string
Api *api.Api
@ -54,11 +58,11 @@ func (g *GoApiGenerator) Generate(apis *api.Api, destFile string) error {
return v, nil
},
})
tpl = template.Must(tpl.ParseFiles("./golang/go_gen.tmpl"))
tpl = template.Must(tpl.Parse(templateString))
var buf bytes.Buffer
if err := tpl.ExecuteTemplate(&buf, "go_gen.tmpl", tplCtx); err != nil {
if err := tpl.ExecuteTemplate(&buf, "gogen", tplCtx); err != nil {
return fmt.Errorf("execute template: %w", err)
}

View File

@ -1,3 +1,5 @@
// Code generated by kitcom. DO NOT EDIT.
import {ParentIPC, ChildIPC} from 'kitten-ipc';
{{- /*gotype: efprojects.com/kitten-ipc/kitcom/ts.tsGenData*/ -}}

View File

@ -9,8 +9,12 @@ import (
"text/template"
"efprojects.com/kitten-ipc/kitcom/api"
_ "embed"
)
//go:embed ts_gen.tmpl
var templateString string
type tsGenData struct {
Api *api.Api
}
@ -37,11 +41,11 @@ func (g *TypescriptApiGenerator) Generate(apis *api.Api, destFile string) error
return td, nil
},
})
tpl = template.Must(tpl.ParseFiles("./ts/ts_gen.tmpl"))
tpl = template.Must(tpl.Parse(templateString))
var buf bytes.Buffer
if err := tpl.ExecuteTemplate(&buf, "ts_gen.tmpl", tplCtx); err != nil {
if err := tpl.ExecuteTemplate(&buf, "tsgen", tplCtx); err != nil {
return fmt.Errorf("execute template: %w", err)
}