Created
March 6, 2017 08:54
-
-
Save tophatsteve/cf5f8d69871d7d97c8456fb05112b91e to your computer and use it in GitHub Desktop.
VS Code Go Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Read from Stdin": { | |
"prefix": "scan", | |
"body": [ | |
"s := bufio.NewScanner(os.Stdin)", | |
"for s.Scan() {", | |
" $1", | |
"}" | |
], | |
"description": "Read from Stdin" | |
}, | |
"Open file to read": { | |
"prefix": "file", | |
"body": [ | |
"file, err := os.Open(\"$1\")", | |
"if err != nil {", | |
" log.Fatalln(err)", | |
"}", | |
"defer file.Close() " | |
], | |
"description": "Open file to read" | |
}, | |
"Read file": { | |
"prefix": "read", | |
"body": [ | |
"file, err := os.Open(\"$1\")", | |
"if err != nil {", | |
" log.Fatalln(err)", | |
"}", | |
"defer file.Close() ", | |
"", | |
"s := bufio.NewScanner(file)", | |
"for s.Scan() {", | |
" $1", | |
"}" | |
], | |
"description": "Open file and read lines" | |
}, | |
"Not implement test" : { | |
"prefix": "test", | |
"body": [ | |
"func Test$1(t *testing.T) {", | |
" assert.Equal(t, true, false, \"test not implemented\")", | |
"}" | |
], | |
"description": "Create an empty test" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment