1// run 2 3// Copyright 2024 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 7package main 8 9var x = 0 10var a = foo() 11var b = x 12 13func foo() int { 14 x++ 15 return x 16} 17 18func main() { 19 if a != 1 { 20 panic("unexpected a value") 21 } 22 if b != 1 { 23 panic("unexpected b value") 24 } 25} 26