diff --git a/doc/code.html b/doc/code.html index 5ae57075ed..625a98c1f1 100644 --- a/doc/code.html +++ b/doc/code.html @@ -323,7 +323,7 @@ foo_amd64.go foo_arm.go -describes a package that builds on +

describes a package that builds on different architectures by parameterizing the file name with $GOARCH.

diff --git a/doc/effective_go.html b/doc/effective_go.html index c9eac99ba5..096a655214 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -1617,40 +1617,49 @@ Now we have the missing piece we needed to explain the design of the append built-in function. The signature of append is different from our custom Append function above. Schematically, it's like this: +

 func append(slice []T, elements...T) []T
 
+

where T is a placeholder for any given type. You can't actually write a function in Go where the type T is determined by the caller. That's why append is built in: it needs support from the compiler. +

What append does is append the elements to the end of the slice and return the result. The result needs to be returned because, as with our hand-written Append, the underlying array may change. This simple example +

 x := []int{1,2,3}
 x = append(x, 4, 5, 6)
 fmt.Println(x)
 
+

prints [1 2 3 4 5 6]. So append works a little like Printf, collecting an arbitrary number of arguments. +

But what if we wanted to do what our Append does and append a slice to a slice? Easy: use ... at the call site, just as we did in the call to Output above. This snippet produces identical output to the one above. +

 x := []int{1,2,3}
 y := []int{4,5,6}
 x = append(x, y...)
 fmt.Println(x)
 
+

Without that ..., it wouldn't compile because the types would be wrong; y is not of type int. +

Initialization

diff --git a/doc/effective_go.tmpl b/doc/effective_go.tmpl index 446b0525e3..340acb4d9f 100644 --- a/doc/effective_go.tmpl +++ b/doc/effective_go.tmpl @@ -1613,40 +1613,49 @@ Now we have the missing piece we needed to explain the design of the append built-in function. The signature of append is different from our custom Append function above. Schematically, it's like this: +

 func append(slice []T, elements...T) []T
 
+

where T is a placeholder for any given type. You can't actually write a function in Go where the type T is determined by the caller. That's why append is built in: it needs support from the compiler. +

What append does is append the elements to the end of the slice and return the result. The result needs to be returned because, as with our hand-written Append, the underlying array may change. This simple example +

 x := []int{1,2,3}
 x = append(x, 4, 5, 6)
 fmt.Println(x)
 
+

prints [1 2 3 4 5 6]. So append works a little like Printf, collecting an arbitrary number of arguments. +

But what if we wanted to do what our Append does and append a slice to a slice? Easy: use ... at the call site, just as we did in the call to Output above. This snippet produces identical output to the one above. +

 x := []int{1,2,3}
 y := []int{4,5,6}
 x = append(x, y...)
 fmt.Println(x)
 
+

Without that ..., it wouldn't compile because the types would be wrong; y is not of type int. +

Initialization

diff --git a/doc/go_faq.html b/doc/go_faq.html index 5e213ff532..443bfd6108 100644 --- a/doc/go_faq.html +++ b/doc/go_faq.html @@ -1524,7 +1524,9 @@ declaration should present the same order as := so
     var a uint64 = 1
 
+

has the same effect as +

     a := uint64(1)
 
diff --git a/doc/go_spec.html b/doc/go_spec.html index ae0a4616a7..1be629146f 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -696,10 +696,11 @@ using a receiver of that type.

Boolean types

+

A boolean type represents the set of Boolean truth values denoted by the predeclared constants true and false. The predeclared boolean type is bool. - +

Numeric types