functions.go (887B)
1 // This file can be used to manually test that go-beginning-of-def and 2 // go-end-of-defun are correct by entering into each function and mark-defun 3 // (C-M-h). 4 package main 5 6 type typea int 7 8 func easy(a, b, c int) int { 9 c += a 10 c += b 11 return c 12 } 13 14 func harder(a chan struct{}) { 15 close(a) 16 } 17 18 func harder(a struct { 19 b struct { 20 c interface { 21 Foo() 22 Bar() 23 Baz() 24 } 25 } 26 }) interface { 27 Channer() chan struct{} 28 } { 29 return nil 30 } 31 32 func oneline(a struct{}) (r struct{ a int }) { return r } 33 34 type typeb struct { 35 a, b, c int 36 } 37 38 // comment1 breaks end-of-defun by splitting "struct" from "{". (This also 39 // apparently breaks gofmt, is why this is formatted so weird.) 40 func comment1(a chan struct /* why? */ { 41 42 }) { 43 close(a) 44 } 45 46 func comment2(a struct { 47 b int // b is sad :{ 48 c int 49 }) { 50 a.b += a.c 51 a.c += a.b 52 return 53 } 54 55 func structWithTag(a chan struct { 56 v int `{` 57 }) { 58 close(a) 59 }