github.com/neilgarb/delve@v1.9.2-nobreaks/_fixtures/locationsprog.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 ) 7 8 type SomeType struct { 9 } 10 11 type OtherType struct { 12 } 13 14 func (a *SomeType) String() string { 15 return "SomeTypeObject" 16 } 17 18 func (a *OtherType) String() string { 19 return "OtherTypeObject" 20 } 21 22 func (a *SomeType) SomeFunction() { 23 fmt.Printf("SomeFunction called\n") 24 } 25 26 func anotherFunction() { 27 fmt.Printf("anotherFunction called\n") 28 } 29 30 func main() { 31 var a SomeType 32 var b OtherType 33 i := 10 34 fmt.Printf("%s %s %v\n", a.String(), b.String(), i) 35 a.SomeFunction() 36 anotherFunction() 37 ioutil.ReadFile("nonexistent.file.txt") 38 } 39 40 var amap map[string]func() 41 42 func init() { 43 amap = map[string]func(){ 44 "k": func() { 45 fmt.Printf("hello world") 46 }, 47 } 48 }