mirror of
https://github.com/golang/go
synced 2024-11-21 17:04:42 -07:00
spec: update spacing to match gofmt, where reasonable.
R=gri, rsc CC=golang-dev https://golang.org/cl/5327053
This commit is contained in:
parent
c6691d1fb4
commit
72a2979ef0
@ -974,7 +974,7 @@ BaseType = Type .
|
||||
|
||||
<pre>
|
||||
*int
|
||||
*map[string] *chan int
|
||||
*map[string]*chan int
|
||||
</pre>
|
||||
|
||||
<h3 id="Function_types">Function types</h3>
|
||||
@ -1153,9 +1153,9 @@ failure will cause a <a href="#Run_time_panics">run-time panic</a>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
map [string] int
|
||||
map [*T] struct { x, y float64 }
|
||||
map [string] interface {}
|
||||
map[string]int
|
||||
map[*T]struct{ x, y float64 }
|
||||
map[string]interface{}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
@ -1174,8 +1174,8 @@ which takes the map type and an optional capacity hint as arguments:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
make(map[string] int)
|
||||
make(map[string] int, 100)
|
||||
make(map[string]int)
|
||||
make(map[string]int, 100)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
@ -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:
|
||||
<pre>
|
||||
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)
|
||||
</pre>
|
||||
|
||||
@ -1639,7 +1639,7 @@ it is only incremented after each ConstSpec:
|
||||
|
||||
<pre>
|
||||
const (
|
||||
bit0, mask0 = 1 << iota, 1 << iota - 1 // bit0 == 1, mask0 == 0
|
||||
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
|
||||
)
|
||||
|
||||
@ -3517,7 +3517,7 @@ order.
|
||||
For example, in the assignment
|
||||
</p>
|
||||
<pre>
|
||||
y[f()], ok = g(h(), i() + x[j()], <-c), k()
|
||||
y[f()], ok = g(h(), i()+x[j()], <-c), k()
|
||||
</pre>
|
||||
<p>
|
||||
the function calls and communication happen in the order
|
||||
@ -4247,7 +4247,7 @@ for { // send random sequence of bits to c
|
||||
}
|
||||
}
|
||||
|
||||
select { } // block forever
|
||||
select {} // block forever
|
||||
</pre>
|
||||
|
||||
|
||||
@ -4647,7 +4647,7 @@ is negative or larger than <code>m</code>, or if <code>n</code> or
|
||||
s := make([]int, 10, 100) // slice with len(s) == 10, cap(s) == 100
|
||||
s := make([]int, 10) // slice with len(s) == cap(s) == 10
|
||||
c := make(chan int, 10) // channel with a buffer size of 10
|
||||
m := make(map[string] int, 100) // map with initial space for 100 elements
|
||||
m := make(map[string]int, 100) // map with initial space for 100 elements
|
||||
</pre>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user