github.com/sean-/go@v0.0.0-20151219100004-97f854cd7bb6/test/rename.go (about) 1 // run 2 3 // Copyright 2009 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 that predeclared names can be redeclared by the user. 8 9 package main 10 11 import ( 12 "fmt" 13 "runtime" 14 ) 15 16 func main() { 17 n := 18 append + 19 bool + 20 byte + 21 complex + 22 complex64 + 23 complex128 + 24 cap + 25 close + 26 delete + 27 error + 28 false + 29 float32 + 30 float64 + 31 imag + 32 int + 33 int8 + 34 int16 + 35 int32 + 36 int64 + 37 len + 38 make + 39 new + 40 nil + 41 panic + 42 print + 43 println + 44 real + 45 recover + 46 rune + 47 string + 48 true + 49 uint + 50 uint8 + 51 uint16 + 52 uint32 + 53 uint64 + 54 uintptr + 55 iota 56 if n != NUM*(NUM-1)/2 { 57 fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2) 58 runtime.Breakpoint() // panic is inaccessible 59 } 60 } 61 62 const ( 63 // cannot use iota here, because iota = 38 below 64 append = 1 65 bool = 2 66 byte = 3 67 complex = 4 68 complex64 = 5 69 complex128 = 6 70 cap = 7 71 close = 8 72 delete = 9 73 error = 10 74 false = 11 75 float32 = 12 76 float64 = 13 77 imag = 14 78 int = 15 79 int8 = 16 80 int16 = 17 81 int32 = 18 82 int64 = 19 83 len = 20 84 make = 21 85 new = 22 86 nil = 23 87 panic = 24 88 print = 25 89 println = 26 90 real = 27 91 recover = 28 92 rune = 29 93 string = 30 94 true = 31 95 uint = 32 96 uint8 = 33 97 uint16 = 34 98 uint32 = 35 99 uint64 = 36 100 uintptr = 37 101 iota = 38 102 NUM = 39 103 )