Plugin Commands
Goctl supports custom plugins for api, so how do I customize a plugin? Let’s take a look at an example of how to finally use it below.
The above command can be broken down into the following steps:
- goctl passes the parsed structure ApiSpec and parameters to the goctl-android executable file
- goctl-android customizes the generation logic according to the ApiSpec structure.
A very simple custom plug-in demo is included in the go-zero framework. The code is as follows:
The function of this line of code is to parse the data passed from goctl, which contains the following parts:
Style: optional, it is used to control file naming conventions
Dir: workDir