github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/test/fixedbugs/issue4964.dir/b.go (about)

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import "./a"
     8  
     9  func F() {
    10  	// store 1 in a.global
    11  	x, y := 1, 2
    12  	t := a.T{Pointer: &x}
    13  	a.Store(&t)
    14  	_ = y
    15  }
    16  
    17  func G() {
    18  	// store 4 in a.global2
    19  	x, y := 3, 4
    20  	t := a.T{Pointer: &y}
    21  	a.Store2(&t)
    22  	_ = x
    23  }
    24  
    25  func main() {
    26  	F()
    27  	G()
    28  	p := a.Get()
    29  	n := *p
    30  	if n != 1 {
    31  		println(n, "!= 1")
    32  		panic("n != 1")
    33  	}
    34  }