codekingpro/portable-devtools
114k
1// run2 3// Copyright 2011 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7// Test zero length structs.8// Used to not be evaluated.9// Issue 2232.10 11package main12 13func recv(c chan interface{}) struct{} {14 return (<-c).(struct{})15}16 17var m = make(map[interface{}]int)18 19func recv1(c chan interface{}) {20 defer rec()21 m[(<-c).(struct{})] = 022}23 24func rec() {25 recover()26}27 28func main() {29 c := make(chan interface{})30 go recv(c)31 c <- struct{}{}32 go recv1(c)33 c <- struct{}{}34}35 