github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/test/fixedbugs/issue1304.go (about)

     1  // run
     2  
     3  // Copyright 2014 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  package main
     8  
     9  var a = 1
    10  
    11  func main() {
    12  	defer func() {
    13  		recover()
    14  		if a != 2 {
    15  			println("BUG a =", a)
    16  		}
    17  	}()
    18  	a = 2
    19  	b := a - a
    20  	c := 4
    21  	a = c / b
    22  	a = 3
    23  }