Unlike most Go programs, the `Main()` function will not be used to run all of the commands provided in your plugin. Main will be used to initialize the plugin process, as well as any dependencies you might require for your plugin.
()
| 74 | // process, as well as any dependencies you might require for your |
| 75 | // plugin. |
| 76 | func main() { |
| 77 | // Any initialization for your plugin can be handled here |
| 78 | // |
| 79 | // Note: to run the plugin.Start method, we pass in a pointer to the struct |
| 80 | // implementing the interface defined at "code.cloudfoundry.org/cli/v8/plugin/plugin.go" |
| 81 | // |
| 82 | // Note: The plugin's main() method is invoked at install time to collect |
| 83 | // metadata. The plugin will exit 0 and the Run([]string) method will not be |
| 84 | // invoked. |
| 85 | plugin.Start(new(BasicPlugin)) |
| 86 | // Plugin code should be written in the Run([]string) method, |
| 87 | // ensuring the plugin environment is bootstrapped. |
| 88 | } |