https://github.com/pieterclaerhout/vscode-snippets
Snippets I'm using for Visual Studio Code
https://github.com/pieterclaerhout/vscode-snippets
golang vscode vscode-snippets
Last synced: 4 months ago
JSON representation
Snippets I'm using for Visual Studio Code
- Host: GitHub
- URL: https://github.com/pieterclaerhout/vscode-snippets
- Owner: pieterclaerhout
- License: apache-2.0
- Created: 2019-09-28T13:26:18.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-24T06:14:41.000Z (about 1 year ago)
- Last Synced: 2025-01-08T18:42:51.232Z (6 months ago)
- Topics: golang, vscode, vscode-snippets
- Size: 891 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Snippets for Visual Studio Code
[](https://github.com/pieterclaerhout/vscode-snippets/raw/master/LICENSE) [](https://badge.fury.io/gh/pieterclaerhout%2Fvscode-snippets)
These are some of the [custom snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets) I'm using for [Visual Studio Code](https://code.visualstudio.com).
## How to install
Just place the desired Go file in:
- macOS: ~/Library/Application Support/Code/User/snippets
- Windows: %HOMEPATH%\AppData\Roaming\Code\User\snippets## Go Snippets
For [Go](https://golang.org), I have two snippets defined:
### `tcimp`
You can use the `tcimp` snippet to quickly add the basic imports needed for writing a test.
It uses the [`testing`](https://golang.org/pkg/testing/) and [`assert`](https://github.com/stretchr/testify#assert-package) libaries.
Just type `tcimp` and you'll get the following snippet:
```go
import (
"testing""github.com/stretchr/testify/assert"
"github.com/"
)
```
### `tc`
Typing `tc` sets up the basic structure for an empty test and results in:
```go
func Test_(t *testing.T) {type test struct {
name string
}var tests = []test{}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
})
}}
```