wujian_develop_tool/template/api/docker/golang/golang.go

27 lines
539 B
Go

package golang
import (
_ "embed"
"git.icechen.cn/pkg/wujian_develop_tool/config"
"github.com/fatih/color"
"git.icechen.cn/pkg/wujian_develop_tool/util"
)
//go:embed "Dockerfile.tpl"
var dockerfileTemplate string
//go:embed "main.tpl"
var mainGoTemplate string
func GenDockerfile(api config.Api) error {
color.Green("正在生成dockerfile...")
err := util.TemplateToFile(api.Root+"/Dockerfile", dockerfileTemplate, api)
if err != nil {
return err
}
return util.TemplateToFile(api.Root+"/main.go", mainGoTemplate, nil)
}