Scope snippets to Go (#51)

Confirmed they only show up in Go code now.
This commit is contained in:
Pieter Noordhuis 2022-09-13 17:58:59 +02:00 committed by GitHub
parent a168eece47
commit 40194cc1a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
{ {
// https://snippet-generator.app/ // https://snippet-generator.app/
"Test case": { "Test case": {
"scope": "go",
"prefix": "te", "prefix": "te",
"body": [ "body": [
"func Test$1(t *testing.T) {", "func Test$1(t *testing.T) {",
@ -10,6 +11,7 @@
"description": "Test case" "description": "Test case"
}, },
"Assert len": { "Assert len": {
"scope": "go",
"prefix": "al", "prefix": "al",
"body": [ "body": [
"assert.Len(t, $1, $2)" "assert.Len(t, $1, $2)"
@ -17,6 +19,7 @@
"description": "Assert len" "description": "Assert len"
}, },
"Method with single error result": { "Method with single error result": {
"scope": "go",
"prefix": "me", "prefix": "me",
"body": [ "body": [
"func (a $1) $2() error {", "func (a $1) $2() error {",
@ -26,6 +29,7 @@
"description": "Method with single error result" "description": "Method with single error result"
}, },
"if err != nil return err": { "if err != nil return err": {
"scope": "go",
"prefix": "ife", "prefix": "ife",
"body": [ "body": [
"if err != nil {", "if err != nil {",
@ -35,6 +39,7 @@
"description": "if err != nil return err" "description": "if err != nil return err"
}, },
"if _ == nil return fmt.Errorf()": { "if _ == nil return fmt.Errorf()": {
"scope": "go",
"prefix": "ifne", "prefix": "ifne",
"body": [ "body": [
"if $1 == nil {", "if $1 == nil {",
@ -44,6 +49,7 @@
"description": "if _ == nil return fmt.Errorf()" "description": "if _ == nil return fmt.Errorf()"
}, },
"if err != nil return ``, err": { "if err != nil return ``, err": {
"scope": "go",
"prefix": "iferrs", "prefix": "iferrs",
"body": [ "body": [
"if err != nil {", "if err != nil {",
@ -53,6 +59,7 @@
"description": "if err != nil return ``, err" "description": "if err != nil return ``, err"
}, },
"assert.EqualError": { "assert.EqualError": {
"scope": "go",
"prefix": "aee", "prefix": "aee",
"body": [ "body": [
"assert.EqualError(t, err, \"..\")" "assert.EqualError(t, err, \"..\")"
@ -60,6 +67,7 @@
"description": "assert.EqualError" "description": "assert.EqualError"
}, },
"assert.Equal": { "assert.Equal": {
"scope": "go",
"prefix": "ae", "prefix": "ae",
"body": [ "body": [
"assert.Equal(t, \"..\", $1)" "assert.Equal(t, \"..\", $1)"
@ -67,6 +75,7 @@
"description": "assert.Equal" "description": "assert.Equal"
}, },
"assert.NoError": { "assert.NoError": {
"scope": "go",
"prefix": "anoe", "prefix": "anoe",
"body": [ "body": [
"assert.NoError(t, err)" "assert.NoError(t, err)"
@ -74,6 +83,7 @@
"description": "assert.NoError" "description": "assert.NoError"
}, },
"err :=": { "err :=": {
"scope": "go",
"prefix": "e", "prefix": "e",
"body": [ "body": [
"err := " "err := "
@ -81,6 +91,7 @@
"description": "err :=" "description": "err :="
}, },
"Golang Error Wrapper": { "Golang Error Wrapper": {
"scope": "go",
"prefix": "ifew", "prefix": "ifew",
"body": [ "body": [
"if err != nil {", "if err != nil {",