If you program in Go, then you work with structs all the time. There’s a handy little tool in VS Code that you can use to quickly populate an empty struct with all its fields instead of writing them by hand. With your cursor over the name of the struct, bring up the context menu by doing one of the following:
- Clicking on the light bulb to the left
- Pressing
Ctrl+.
(Windows/Linux) - Pressing Cmd+. (Max)
Then, click on the “Fill” option or press ENTER to accept it, and the struct’s fields will be added along with default values for each according to their type:
This little productivity tool is great, especially when you’re mapping data across structs in different parts of your application.