1// skip 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// Test the -X facility of the gc linker (6l etc.). 8// This test is run by linkx_run.go. 9 10package main 11 12import "fmt" 13 14var tbd string 15var overwrite string = "dibs" 16 17var tbdcopy = tbd 18var overwritecopy = overwrite 19var arraycopy = [2]string{tbd, overwrite} 20 21var b bool 22var x int 23 24func main() { 25 fmt.Println(tbd) 26 fmt.Println(tbdcopy) 27 fmt.Println(arraycopy[0]) 28 29 fmt.Println(overwrite) 30 fmt.Println(overwritecopy) 31 fmt.Println(arraycopy[1]) 32 33 // Check non-string symbols are not overwritten. 34 // This also make them used. 35 if b || x != 0 { 36 panic("b or x overwritten") 37 } 38} 39