diff --git a/doc/effective_go.html b/doc/effective_go.html index 2ecef44f41d..296939e0dfd 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -116,7 +116,7 @@ Some formatting details remain. Very briefly,
if
,
- for
, switch
) do not require parentheses in
+ for
, switch
) do not have parentheses in
their syntax.
Also, the operator precedence hierarchy is shorter and clearer, so
@@ -405,7 +405,7 @@ break continue fallthrough return ++ -- ) }the lexer always inserts a semicolon after the token. This could be summarized as, “if the newline comes -after a token that could end a statement, add a semicolon”. +after a token that could end a statement, insert a semicolon”.
@@ -461,7 +461,7 @@ initialization statement like that of
@@ -564,7 +564,7 @@ for i := 0; i < 10; i++ {for
; and there are new control structures including a type switch and a multiway communications multiplexer,select
. The syntax is also slightly different: -parentheses are not required +there are no parentheses and the bodies must always be brace-delimited.If you're looping over an array, slice, string, or map, or reading from a channel, a
range
clause can -manage the loop for you. +manage the loop.var m map[string]int @@ -943,8 +943,11 @@ Go has two allocation primitives, the built-in functions They do different things and apply to different types, which can be confusing, but the rules are simple. Let's talk aboutnew
first. -It's a built-in function essentially the same as its namesakes -in other languages:new(T)
allocates zeroed storage for a new item of type +It's a built-in function that allocates memory, but unlike its namesakes +in some other languages it does not initialize the memory, +it only zeroes it. +That is, +new(T)
allocates zeroed storage for a new item of typeT
and returns its address, a value of type*T
. In Go terminology, it returns a pointer to a newly allocated zero value of typeT
.