modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue7272.go (about) 1 // compile 2 3 // Copyright 2012 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Issue 7272: test builtin functions in statement context and in 8 // go/defer functions. 9 10 package p 11 12 func F() { 13 var a []int 14 var c chan int 15 var m map[int]int 16 17 close(c) 18 copy(a, a) 19 delete(m, 0) 20 panic(0) 21 print("foo") 22 println("bar") 23 recover() 24 25 (close(c)) 26 (copy(a, a)) 27 (delete(m, 0)) 28 (panic(0)) 29 (print("foo")) 30 (println("bar")) 31 (recover()) 32 33 go close(c) 34 go copy(a, a) 35 go delete(m, 0) 36 go panic(0) 37 go print("foo") 38 go println("bar") 39 go recover() 40 41 defer close(c) 42 defer copy(a, a) 43 defer delete(m, 0) 44 defer panic(0) 45 defer print("foo") 46 defer println("bar") 47 defer recover() 48 }