You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/tools/modelctl/model/configtemplategen/gen.go

29 lines
517 B
Go

4 years ago
package configgen
import (
"fmt"
"os"
"github.com/tal-tech/go-zero/tools/modelctl/model"
4 years ago
"github.com/urfave/cli"
)
var (
configFileName = "config.json"
)
func ConfigCommand(_ *cli.Context) error {
_, err := os.Stat(configFileName)
if err == nil {
return nil
}
file, err := os.OpenFile(configFileName, os.O_CREATE|os.O_WRONLY, model.ModeDirPerm)
if err != nil {
return err
}
file.WriteString(configTemplate)
defer file.Close()
fmt.Println("config json template generate done ... ")
return nil
}