Goland function comment generation plugin
There are many introductions on the Internet on how to use goland to generate function annotation templates, for example, some introductions are written in Live Template.
You can refer to this article to configure Preferences | Editor | Live Templates Configuration Documentation
Let me tell you first, it can take effect, but the premise is that your cursor is inside the function and cannot be placed at the head of the function, and the generated comment is also inside the function, and you need to manually copy it out later. In addition, some features of goland, such as function receivers, cannot support multiple returns.
Since I haven't found a fully usable solution for the time being, I took the time to simply write a plug-in that automatically generates goland comments. At present, there are already 400+ download users using it.
goanno
It can be downloaded by searching goanno through the plug-in market of goland or idea.
You can also download the release package directly from the following website and install it through the local installation plug-in.
https://plugins.jetbrains.com/plugin/14988-goanno
https://github.com/loveinsky100/goanno
Perfectly supports goland's function annotations, including interface/common functions/function receivers/multiple output parameters
How to use
There are currently two ways
to generate annotations
1. Shortcut key control + commond + / (windows user shortcut key configuration reference: GoLand quick method annotation )
2. Manual generation: right mouse button -> select Generate -> select Goanno
PS: If the shortcut keys are uncomfortable, especially for Windows users, please let me know that you can adjust the keys
Adjust the template (the default template is java style, you can adjust it to the style recommended by golang by modifying the template)
Select "Tools - Goanno Setting" in the navigation bar