Skip to content

goctl Template

Template(s) are the basis for data driver’s generation; all codes (rest api, rpc, model, docker, kube) are generated by the template, By default, the template generator selects the template in memory and, for developers who need the template to modify the template, requires the template to be disked, to modify the template so that the template will be loaded from the specified path when the next code is generated.

Terminal window
$ goctl template --help
Template operation
Usage:
goctl template [command]
Available Commands:
clean Clean the all cache templates
init Initialize the all templates(force update)
revert Revert the target template to the latest
update Update template of the target category to the latest
Flags:
-h, --help help for template
Use "goctl template [command] --help" for more information about a command.

goctl template clean is used to delete persistent local template files.

Terminal window
$ goctl template clean --help
Clean the all cache templates
Usage:
goctl template clean [flags]
Flags:
-h, --help help for clean
--home string The goctl home path of the template

goctl template init for initialization templates, which store template files locally.

Terminal window
$ goctl template init --help
Initialize the all templates(force update)
Usage:
goctl template init [flags]
Flags:
-h, --help help for init
--home string The goctl home path of the template

goctl template revert is used to roll back the specified template file in a category.

Terminal window
$ goctl template revert --help
Revert the target template to the latest
Usage:
goctl template revert [flags]
Flags:
-c, --category string The category of template, enum [api,rpc,model,docker,kube]
-h, --help help for revert
--home string The goctl home path of the template
-n, --name string The target file name of template
Parameter field Parameter Type Required? Default value Parameter Description
categorystringYESEmpty string模板分类,api|rpc|model|docker|kube
homestringYES${HOME}/.goctlFile location stored in template
namestringYESEmpty stringTemplate File Name

goctl template update is used to roll back all template files under a category.

Terminal window
$ goctl template update --help
Update template of the target category to the latest
Usage:
goctl template update [flags]
Flags:
-c, --category string The category of template, enum [api,rpc,model,docker,kube]
-h, --help help for update
--home string The goctl home path of the template
Parameter field Parameter Type Required? Default value Parameter Description
categorystringYESEmpty stringTemplate Category,api|rpc|model|docker|kube
homestringYES${HOME}/.goctlFile location stored in template