diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets index 35cf9091d..d8d83f3fc 100644 --- a/UltiSnips/go.snippets +++ b/UltiSnips/go.snippets @@ -65,6 +65,7 @@ func main() { endsnippet snippet /^meth/ "Method" r +// $3 ... func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { ${0:${VISUAL}} } diff --git a/snippets/go.snippets b/snippets/go.snippets index 1804019b5..63dbdf469 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -267,11 +267,19 @@ snippet errwr "Error handling with errors.Wrap" return errors.Wrap(err, "${2}") } +snippet dp "print debug info" + func (){ + // DEBUG: remove before commit + _, file, line, _ := runtime.Caller(0) + fmt.Println(file, line, ${1}) + }() + snippet jp "json Marshal and print" func (name string){ // DEBUG: remove before commit + _, file, line, _ := runtime.Caller(0) jb, _ := json.MarshalIndent(${1}, "", " ") - fmt.Printf("\n[%s]\n%s\n\n", name, string(jb)) + fmt.Printf("\n[%s:%s - %s]\n%s\n\n", file, line, name, string(jb)) _ = ioutil.WriteFile(name + ".json", jb, 0644) }("${2}")