1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
// A line comment.
/*
A general comment.
*/
// Keywords
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
// Operators, delimiters and special tokens
+ & += &= && == != ( )
- | -= |= || < <= [ ]
* ^ *= ^= <- > >= { }
/ << /= <<= ++ = := , ;
% >> %= >>= -- ! ... . :
&^ &^=
// Integer literals
42
0600
0xBadFace
170141183460469231731687303715884105727
// Floating-point literals
0.
72.40
072.40
2.71828
1.e+0
6.67428e-11
1E6
.25
.12345E+5
// Imaginary literals
0i
011i
0.i
2.71828i
1.e+0i
6.67428e-11i
1E6i
.25i
.12345E+5i
// Character literals
'a'
'ä'
'本'
'\t'
'\000'
'\007'
'\377'
'\x07'
'\xff'
'\u12e4'
'\U00101234'
// String literals
`abc`
`\n
\n`
"\n"
""
"Hello, world!\n"
"日本語"
"\u65e5本\U00008a9e"
"\xff\u00FF"
"\uD800" // illegal: surrogate half
"\U00110000" // illegal: invalid Unicode code point
"\z" // illegal
// Predeclared identifiers
// Types:
bool byte complex64 complex128 error float32 float64
int int8 int16 int32 int64 rune string
uint uint8 uint16 uint32 uint64 uintptr
// Constants:
true false iota
// Zero value:
nil
// Functions:
append cap close complex copy delete imag len
make new panic print println real recover
// Types
type T1 string
type T2 T1
type T3 []T1
type T4 T3
// Array types
[32]byte
[2*N] struct { x, y int32 }
[1000]*float64
[3][5]int
[2][2][2]float64
// Struct types
struct {}
struct {
x, y int
u float32
_ float32
A *[]int
F func()
}
struct {
T1
*T2
P.T3
*P.T4
x, y int
}
struct {
T
*T
*P.T
}
struct {
microsec uint64 "field 1"
serverIP6 uint64 "field 2"
process string "field 3"
}
// Function types
func()
func(x int) int
func(a, _ int, z float32) bool
func(a, b int, z float32) (bool)
func(prefix string, values ...int)
func(a, b int, z float64, opt ...interface{}) (success bool)
func(int, int, float64) (float64, *[]int)
func(n int) func(p *T)
// Interface types
interface {
Read(b Buffer) bool
Write(b Buffer) bool
Close()
}
type Lock interface {
Lock()
Unlock()
}
// Channel types
chan T
chan<- float64
<-chan int
chan<- chan int
chan<- <-chan int
<-chan <-chan int
chan (<-chan int)
|