GoTools/README.md

48 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2021-03-22 05:17:45 +03:00
# Golang Tools
2021-03-19 02:22:55 +03:00
2021-03-28 21:48:26 +03:00
[Install extension from Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=neonxp.gotools)
[Install extension from Open-VSX](https://open-vsx.org/extension/neonxp/gotools) (codeserver/vscodium/gitpod)
2021-03-19 03:24:12 +03:00
2021-03-22 05:17:45 +03:00
Extensions with frequently used snippets and code actions for productive go development.
2021-03-19 02:22:55 +03:00
Extension in active development! Your contribution is always welcome :)
2021-03-22 05:17:45 +03:00
# Snippets
2023-08-06 01:23:45 +03:00
| Prefix| Description|
| :---- |:----------:|
| `pkg` | Package header line |
| `construct` | Constructor for structure type |
| `iferr` |if err := fuction(); err != nil { ... }|
2021-03-22 05:17:45 +03:00
# Code actions
2021-03-28 04:48:10 +03:00
`Add error checking` - adds stub error checking to current line:
<img src="/wraperror.gif" width="500" />
2023-08-07 21:08:48 +03:00
# Interface implementation
2023-08-08 02:40:09 +03:00
Command "Go: Implement Interface Methods" based on https://github.com/ricardoerikson/vscode-go-impl-methods/ extension by Ricardo Erikson.
2023-08-07 21:08:48 +03:00
Install the impl package as follows:
```
go get -u github.com/josharian/impl
```
## Usage
1. At command pallete select command "Go: Implement Interface Methods"
2. Write receiver for methods. Example: "f *File", "m MyType", "c CustomType"
3. Select interface to implement
2023-08-08 02:40:09 +03:00
# Group imports
Group imports command based on https://github.com/gustavo-bordin/golang-imports-group/ extension by Gustavo Bordin.
## Usage
1. At command pallete select command "Go: Group imports"