From 5b5faf3ef1a51a0e261e2fc840e2a4ab354bcdcd Mon Sep 17 00:00:00 2001
From: David Symonds
struct {
- T // conflicts with anonymous field *T and *P.T
- *T // conflicts with anonymous field T and *P.T
- *P.T // conflicts with anonymous field T and *T
+ T // conflicts with anonymous field *T and *P.T
+ *T // conflicts with anonymous field T and *P.T
+ *P.T // conflicts with anonymous field T and *T
}
@@ -974,7 +974,7 @@ BaseType = Type .
*int
-*map[string] *chan int
+*map[string]*chan int
Function types
@@ -1153,9 +1153,9 @@ failure will cause a run-time panic.
-map [string] int -map [*T] struct { x, y float64 } -map [string] interface {} +map[string]int +map[*T]struct{ x, y float64 } +map[string]interface{}
@@ -1174,8 +1174,8 @@ which takes the map type and an optional capacity hint as arguments:
-make(map[string] int) -make(map[string] int, 100) +make(map[string]int) +make(map[string]int, 100)
@@ -1207,9 +1207,9 @@ A channel may be constrained only to send or only to receive by
-chan T // can be used to send and receive values of type T -chan<- float64 // can only be used to send float64s -<-chan int // can only be used to receive ints +chan T // can be used to send and receive values of type T +chan<- float64 // can only be used to send float64s +<-chan int // can only be used to receive ints
@@ -1218,9 +1218,9 @@ possible:
-chan<- chan int // same as chan<- (chan int) -chan<- <-chan int // same as chan<- (<-chan int) -<-chan <-chan int // same as <-chan (<-chan int) +chan<- chan int // same as chan<- (chan int) +chan<- <-chan int // same as chan<- (<-chan int) +<-chan <-chan int // same as <-chan (<-chan int) chan (<-chan int)@@ -1306,8 +1306,8 @@ Given the declarations type ( T0 []string T1 []string - T2 struct { a, b int } - T3 struct { a, c int } + T2 struct{ a, b int } + T3 struct{ a, c int } T4 func(int, float64) *T0 T5 func(x int, y float64) *[]string ) @@ -1320,7 +1320,7 @@ these types are identical:
T0 and T0 []int and []int -struct { a, b *T5 } and struct { a, b *T5 } +struct{ a, b *T5 } and struct{ a, b *T5 } func(x int, y float64) *[]string and func(int, float64) (result *[]string)@@ -1564,10 +1564,10 @@ constant, even if the literal's fractional part is zero.
const Pi float64 = 3.14159265358979323846 -const zero = 0.0 // untyped floating-point constant +const zero = 0.0 // untyped floating-point constant const ( size int64 = 1024 - eof = -1 // untyped integer constant + eof = -1 // untyped integer constant ) const a, b, c = 3, 4, "foo" // a = 3, b = 4, c = "foo", untyped integer and string constants const u, v float32 = 0, 3 // u = 0.0, v = 3.0 @@ -1639,10 +1639,10 @@ it is only incremented after each ConstSpec:@@ -3337,11 +3337,11 @@ string containing the UTF-8 representation of the integer. Values outside the range of valid Unicode code points are converted toconst ( - bit0, mask0 = 1 << iota, 1 << iota - 1 // bit0 == 1, mask0 == 0 - bit1, mask1 // bit1 == 2, mask1 == 1 - _, _ // skips iota == 2 - bit3, mask3 // bit3 == 8, mask3 == 7 + bit0, mask0 = 1 << iota, 1<<iota - 1 // bit0 == 1, mask0 == 0 + bit1, mask1 // bit1 == 2, mask1 == 1 + _, _ // skips iota == 2 + bit3, mask3 // bit3 == 8, mask3 == 7 )@@ -1670,7 +1670,7 @@ TypeSpec = identifier Type . type IntArray [16]int type ( - Point struct { x, y float64 } + Point struct{ x, y float64 } Polar Point ) @@ -1753,7 +1753,7 @@ var U, V, W float64 var k = 0 var x, y float32 = -1, -2 var ( - i int + i int u, v, s = 2.0, 3.0, "bar" ) var re, im = complexSqrt(-1) @@ -2090,9 +2090,9 @@ to the maximum element index plus one.-buffer := [10]string{} // len(buffer) == 10 -intSet := [6]int{1, 2, 3, 5} // len(intSet) == 6 -days := [...]string{"Sat", "Sun"} // len(days) == 2 +buffer := [10]string{} // len(buffer) == 10 +intSet := [6]int{1, 2, 3, 5} // len(intSet) == 6 +days := [...]string{"Sat", "Sun"} // len(days) == 2@@ -2331,13 +2331,13 @@ one may write:
-p.z // (*p).z -p.y // ((*p).T1).y -p.x // (*(*p).T0).x +p.z // (*p).z +p.y // ((*p).T1).y +p.x // (*(*p).T0).x -p.M2 // (*p).M2 -p.M1 // ((*p).T1).M1 -p.M0 // ((*p).T0).M0 +p.M2 // (*p).M2 +p.M1 // ((*p).T1).M1 +p.M0 // ((*p).T0).M0@@ -2476,9 +2476,9 @@ sliced operand:-a[2:] // same a[2 : len(a)] -a[:3] // same as a[0 : 3] -a[:] // same as a[0 : len(a)] +a[2:] // same a[2 : len(a)] +a[:3] // same as a[0 : 3] +a[:] // same as a[0 : len(a)]@@ -2571,7 +2571,7 @@ the method.
-math.Atan2(x, y) // function call +math.Atan2(x, y) // function call var pt *Point pt.Scale(3.5) // method call with receiver pt@@ -3091,7 +3091,7 @@ Consider a struct typeT
with two methods, type T struct { a int } -func (tv T) Mv(a int) int { return 0 } // value receiver +func (tv T) Mv(a int) int { return 0 } // value receiver func (tp *T) Mp(f float32) float32 { return 1 } // pointer receiver var t T
"\uFFFD"
.
-string('a') // "a" -string(-1) // "\ufffd" == "\xef\xbf\xbd " -string(0xf8) // "\u00f8" == "ø" == "\xc3\xb8" +string('a') // "a" +string(-1) // "\ufffd" == "\xef\xbf\xbd " +string(0xf8) // "\u00f8" == "ø" == "\xc3\xb8" type MyString string -MyString(0x65e5) // "\u65e5" == "日" == "\xe6\x97\xa5" +MyString(0x65e5) // "\u65e5" == "日" == "\xe6\x97\xa5"@@ -3351,7 +3351,7 @@ a string whose successive bytes are the elements of the slice. If the slice value is
nil
, the result is the empty string.
-string([]byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}) // "hellø" +string([]byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}) // "hellø" type MyBytes []byte string(MyBytes{'h', 'e', 'l', 'l', '\xc3', '\xb8'}) // "hellø" @@ -3365,7 +3365,7 @@ converted to strings. If the slice value isnil
, the result is the empty string.-string([]rune{0x767d, 0x9d6c, 0x7fd4}) // "\u767d\u9d6c\u7fd4" == "白鵬翔" +string([]rune{0x767d, 0x9d6c, 0x7fd4}) // "\u767d\u9d6c\u7fd4" == "白鵬翔" type MyRunes []rune string(MyRunes{0x767d, 0x9d6c, 0x7fd4}) // "\u767d\u9d6c\u7fd4" == "白鵬翔" @@ -3378,8 +3378,8 @@ yields a slice whose successive elements are the bytes of the string. If the string is empty, the result is[]byte(nil)
.-[]byte("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'} -MyBytes("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'} +[]byte("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'} +MyBytes("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}@@ -3473,11 +3473,11 @@ of the constant type. The following constant expressions are illegal:-uint(-1) // -1 cannot be represented as a uint -int(3.14) // 3.14 cannot be represented as an int -int64(Huge) // 1<<100 cannot be represented as an int64 -Four * 300 // 300 cannot be represented as an int8 -Four * 100 // 400 cannot be represented as an int8 +uint(-1) // -1 cannot be represented as a uint +int(3.14) // 3.14 cannot be represented as an int +int64(Huge) // 1<<100 cannot be represented as an int64 +Four * 300 // 300 cannot be represented as an int8 +Four * 100 // 400 cannot be represented as an int8@@ -3487,11 +3487,11 @@ and -1 for signed and untyped constants.
-^1 // untyped integer constant, equal to -2 -uint8(^1) // error, same as uint8(-2), out of range -^uint8(1) // typed uint8 constant, same as 0xFF ^ uint8(1) = uint8(0xFE) -int8(^1) // same as int8(-2) -^int8(1) // same as -1 ^ int8(1) = -2 +^1 // untyped integer constant, equal to -2 +uint8(^1) // error, same as uint8(-2), out of range +^uint8(1) // typed uint8 constant, same as 0xFF ^ uint8(1) = uint8(0xFE) +int8(^1) // same as int8(-2) +^int8(1) // same as -1 ^ int8(1) = -2