diff --git a/doc/go_faq.html b/doc/go_faq.html index ab37696f0f..5c68aa7e58 100644 --- a/doc/go_faq.html +++ b/doc/go_faq.html @@ -208,7 +208,7 @@ easier to understand what happens when things combine.
-Yes. There are now several Go programs deployed in
+Yes. There are now several Go programs deployed in
production inside Google. A public example is the server behind
http://golang.org.
It's just the godoc
@@ -224,14 +224,14 @@ There are two Go compiler implementations, gc
(the 6g
program and friends) and gccgo
.
Gc
uses a different calling convention and linker and can
therefore only be linked with C programs using the same convention.
-There is such a C compiler but no C++ compiler.
-Gccgo
is a GCC front-end that can, with care, be linked with
-GCC-compiled C or C++ programs.
+There is such a C compiler but no C++ compiler.
+Gccgo
is a GCC front-end that can, with care, be linked with
+GCC-compiled C or C++ programs.
-The cgo program provides the mechanism for a -“foreign function interface” to allow safe calling of +The cgo program provides the mechanism for a +“foreign function interface” to allow safe calling of C libraries from Go code. SWIG extends this capability to C++ libraries.
@@ -597,7 +597,7 @@ func (b Bar) Foo() {}-Most code doesn't make use of such constraints, since they limit the utility of +Most code doesn't make use of such constraints, since they limit the utility of the interface idea. Sometimes, though, they're necessary to resolve ambiguities among similar interfaces.
@@ -934,7 +934,7 @@ When the project launched, Google Code supported only Subversion and Mercurial. Mercurial was a better choice because of its plugin mechanism that allowed us to create the "codereview" plugin to connect -the project to the excellent code review tools at +the project to the excellent code review tools at codereview.appspot.com. @@ -971,7 +971,7 @@ slice value doesn't copy the data it points to. Copying an interface value makes a copy of the thing stored in the interface value. If the interface value holds a struct, copying the interface value makes a copy of the struct. If the interface value holds a pointer, copying the interface value -makes a copy of the pointer, but again not the data it points to. +makes a copy of the pointer, but again not the data it points to.GOMAXPROCS
shell environment variable
or use the similarly-named function
of the runtime package to allow the
-run-time support to utilize more than one OS thread.
+run-time support to utilize more than one OS thread.
@@ -1161,7 +1161,7 @@ Why does using GOMAXPROCS
> 1 sometimes make my program
slower?
-It depends on the nature of your program. +It depends on the nature of your program. Problems that are intrinsically sequential cannot be sped up by adding more goroutines. Concurrency only becomes parallelism when the problem is @@ -1250,18 +1250,18 @@ func main() { // wait for all goroutines to complete before exiting for _ = range values { - <-done + <-done } }
-One might mistakenly expect to see a, b, c
as the output.
-What you'll probably see instead is c, c, c
. This is because
+One might mistakenly expect to see a, b, c
as the output.
+What you'll probably see instead is c, c, c
. This is because
each iteration of the loop uses the same instance of the variable v
, so
-each closure shares that single variable. When the closure runs, it prints the
+each closure shares that single variable. When the closure runs, it prints the
value of v
at the time fmt.Println
is executed,
-but v
may have been modified since the goroutine was launched.
+but v
may have been modified since the goroutine was launched.
To help detect this and other problems before they happen, run
go vet
.
-In this example, the value of v
is passed as an argument to the
+In this example, the value of v
is passed as an argument to the
anonymous function. That value is then accessible inside the function as
the variable u
.
When developing code, it's common to create these situations temporarily and it can be annoying to have to edit them out before the -program will compile. +program will compile.
@@ -1525,13 +1525,13 @@ Why does Go perform badly on benchmark X?
One of Go's design goals is to approach the performance of C for comparable -programs, yet on some benchmarks it does quite poorly, including several -in test/bench/shootout. The slowest depend on libraries -for which versions of comparable performance are not available in Go. +programs, yet on some benchmarks it does quite poorly, including several +in test/bench/shootout. The slowest depend on libraries +for which versions of comparable performance are not available in Go. For instance, pidigits.go depends on a multi-precision math package, and the C versions, unlike Go's, use GMP (which is -written in optimized assembler). +written in optimized assembler). Benchmarks that depend on regular expressions (regex-dna.go, for instance) are essentially comparing Go's native regexp package to @@ -1550,7 +1550,7 @@ indicate.
Still, there is room for improvement. The compilers are good but could be better, many libraries need major performance work, and the garbage collector -isn't fast enough yet. (Even if it were, taking care not to generate unnecessary +isn't fast enough yet. (Even if it were, taking care not to generate unnecessary garbage can have a huge effect.)
diff --git a/doc/go_spec.html b/doc/go_spec.html index c93bb6c65d..b8502bd5a7 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -2506,7 +2506,7 @@ Ifa
is not a map:
x
must be an integer value; it is in range if 0 <= x < len(a)
,
otherwise it is out of rangeint
+ and representable by a value of type int
@@ -2518,7 +2518,7 @@ where A
is an array type:
a
is nil
or if x
is out of range at run time,
a run-time panic occursa[x]
is the array element at index x
and the type of
- a[x]
is the element type of A
a[x]
is the element type of A
@@ -2528,7 +2528,7 @@ For a
of type S
where S
is a run-time panic occurs
a[x]
is the slice element at index x
and the type of
- a[x]
is the element type of S
a[x]
is the element type of S
@@ -2541,7 +2541,7 @@ where T
is a string type:
x
is out of range at run time,
a run-time panic occursa[x]
is the byte at index x
and the type of
- a[x]
is byte
a[x]
is byte
a[x]
may not be assigned toM
is a map type:
x
's type must be
- assignable
- to the key type of M
M
x
,
- a[x]
is the map value with key x
- and the type of a[x]
is the value type of M
a[x]
is the map value with key x
+ and the type of a[x]
is the value type of M
nil
or does not contain such an entry,
- a[x]
is the zero value
- for the value type of M
a[x]
is the zero value
+ for the value type of M
@@ -5008,7 +5008,7 @@ a run-time panic occurs. s := make([]int, 10, 100) // slice with len(s) == 10, cap(s) == 100 s := make([]int, 1e3) // slice with len(s) == cap(s) == 1000 s := make([]int, 1<<63) // illegal: len(s) is not representable by a value of type int -s := make([]int, 10, 0) // illegal: len(s) > cap(s) +s := make([]int, 10, 0) // illegal: len(s) > cap(s) 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