Go Source ActionThis Visual Studio Code extension streamlines the generation of boilerplate code for Go structures. It focuses on trivial code generation tasks like getters and setters, constructors, and interface stubs. More complicated tasks, such as handling nested struct, are out of scope for this extension. This extension is inspired by Language Support for Java(TM) by Red. QuickStartThere are multiple ways to trigger the code generation. For example, you can use Alternatively, you can use the command palette (e.g., Requirementsimpl command has to be installed for "Gererate Interface Stub" feature. FeaturesGenerate Getters and SettersGenerates getters and setters for the fields of the structure with nil protection.
If no nil protection is needed, you can disable it in vscode settings.
Generate ConstructorsGenerates constructors for the structure.
Generate Interface StubGenerates an interface stub for the structure.
This feature is originally provided by vscode-go extension, and I made a tiny modification to omit the need to explicitly specify the receiver and struct name. Extension SettingsThis extension contributes the following settings:
For example, if you don't want to return
then the generated code will look like this.
LicenseThis project is licensed under the GPLv3 license see GPLv3.0 |