add runner

This commit is contained in:
kim
2020-08-08 15:16:59 +08:00
committed by Kevin Wan
parent 760d3c8c4b
commit b1e8dd62da
8 changed files with 25 additions and 16 deletions

View File

@@ -2,10 +2,11 @@ package gogen
import (
"bytes"
"fmt"
"text/template"
"zero/tools/goctl/api/spec"
"zero/tools/goctl/api/util"
"zero/tools/goctl/vars"
)
const (
@@ -13,7 +14,6 @@ const (
configTemplate = `package config
import (
"zero/rest"
{{.authImport}}
)
@@ -23,7 +23,7 @@ type Config struct {
`
)
func genConfig(dir string, api *spec.ApiSpec) error {
func genConfig(dir string) error {
fp, created, err := util.MaybeCreateFile(dir, configDir, configFile)
if err != nil {
return err
@@ -33,7 +33,7 @@ func genConfig(dir string, api *spec.ApiSpec) error {
}
defer fp.Close()
var authImportStr = ""
var authImportStr = fmt.Sprintf("\"%s/rest\"", vars.ProjectOpenSourceUrl)
t := template.Must(template.New("configTemplate").Parse(configTemplate))
buffer := new(bytes.Buffer)
err = t.Execute(buffer, map[string]string{