mirror of
https://github.com/cubixle/tuugen.git
synced 2026-04-24 22:54:44 +01:00
26 lines
376 B
Go
26 lines
376 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"html/template"
|
|
)
|
|
|
|
func GenerateMain(FS embed.FS, cfg Config) error {
|
|
t, err := template.ParseFS(FS, "templates/main.go.tmpl")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
outputFile := "cmd/app/main.go"
|
|
f, err := createFile(outputFile)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := t.Execute(f, cfg); err != nil {
|
|
return err
|
|
}
|
|
|
|
return f.Close()
|
|
}
|