{ // Place your df2 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. // Placeholders with the same ids are connected. // Example: // "Print to console": { // "scope": "javascript,typescript", // "prefix": "log", // "body": [ // "console.log('$1');", // "$2" // ], // "description": "Log output to console" // } "Connect to database": { "scope": "go", "prefix": "db", "body": [ "db, err := database.Connect(cfg)", "if err != nil {", " log.Fatal(err)", "}", "defer db.Close()", ], "description": "Create a database connection db variable" }, "db is nil check": { "scope": "go", "prefix": "ifdb", "body": [ "if db == nil {", "return database.ErrDB", "}", ], }, "t error":{ "scope": "go", "prefix": "terr", "body": [ "if err != nil {", "t.Error(err)", "}", ], }, "tt := tt":{ "scope": "go", "prefix": "tt", "body": "tt:=tt", }, "l zap logger is nil check":{ "scope": "go", "prefix": "ifzap", "body": [ "if l == nil {", "return ErrZap", "}", ], }, "w writer is nil check":{ "scope": "go", "prefix": "ifw", "body": [ "if w == nil {", "w = io.Discard", "}", ], }, "assert err != nil":{ "scope": "go", "prefix": "nn", "body": ["assert.NotNil(t, err)"], }, }