mirror of
https://github.com/golang/go
synced 2024-11-21 19:14:44 -07:00
doc: faq updates part one
R=r, r2 CC=golang-dev https://golang.org/cl/2301041
This commit is contained in:
parent
686490ce17
commit
5ec55c5134
@ -191,37 +191,31 @@ if they enjoy it. Not every programmer
|
|||||||
will, but we hope enough will find satisfaction in the approach it
|
will, but we hope enough will find satisfaction in the approach it
|
||||||
offers to justify further development.
|
offers to justify further development.
|
||||||
|
|
||||||
<h3 id="Is_Google_using_go_internally"> Is Google using Go
|
<h3 id="Is_Google_using_go_internally"> Is Google using Go internally?</h3>
|
||||||
internally?</h3>
|
|
||||||
|
|
||||||
<p> The Go project was conceived to make it easier to write the kind
|
<p>Yes. There are now several Go programs deployed in
|
||||||
of servers and other software Google uses internally, but the
|
production inside Google. For instance, the server behind
|
||||||
implementation isn't quite mature enough yet for large-scale
|
<a href="http://golang.org">http://golang.org</a> is a Go program;
|
||||||
production use. While we continue development we are also doing
|
in fact it's just the <a href="/cmd/godoc"><code>godoc</code></a>
|
||||||
experiments with the language as a candidate server environment. It's
|
document server running in a production configuration.
|
||||||
getting there. For instance, the server behind <a
|
|
||||||
href="http://golang.org">http://golang.org</a> is a Go program; in
|
|
||||||
fact it's just the <a href="/cmd/godoc"><code>godoc</code></a> document server running in a
|
|
||||||
production configuration.
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="Do_Go_programs_link_with_Cpp_programs">
|
<h3 id="Do_Go_programs_link_with_Cpp_programs">
|
||||||
Do Go programs link with C/C++ programs?</h3>
|
Do Go programs link with C/C++ programs?</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
There are two Go compiler implementations, <code>6g</code> and friends, generically called
|
There are two Go compiler implementations, <code>6g</code> and friends,
|
||||||
<code>gc</code>, and <code>gccgo</code>.
|
generically called <code>gc</code>, and <code>gccgo</code>.
|
||||||
<code>Gc</code> uses a different calling convention and linker and can
|
<code>Gc</code> uses a different calling convention and linker and can
|
||||||
therefore only be linked with C programs using the same convention.
|
therefore only be linked with C programs using the same convention.
|
||||||
There is such a C compiler but no C++ compiler. <code>Gccgo</code> is a
|
There is such a C compiler but no C++ compiler.
|
||||||
GCC front-end that can, with care, be linked with GCC-compiled
|
<code>Gccgo</code> is a GCC front-end that can, with care, be linked with
|
||||||
C or C++ programs. However, because Go is garbage-collected it will be
|
GCC-compiled C or C++ programs.
|
||||||
unwise to do so, at least naively.
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
There is a “foreign function interface” to allow safe calling of C-written
|
The <a href="/cmd/cgo/">cgo</a> program provides the mechanism for a
|
||||||
libraries from Go code. We expect to use SWIG to extend this capability
|
“foreign function interface” to allow safe calling of
|
||||||
to C++ libraries. There is no safe way to call Go code from C or C++ yet.
|
C libraries from Go code. SWIG extends this capability to C++ libraries.
|
||||||
|
|
||||||
<h3 id="Does_Go_support_Google_protocol_buffers">
|
<h3 id="Does_Go_support_Google_protocol_buffers">
|
||||||
Does Go support Google's protocol buffers?</h3>
|
Does Go support Google's protocol buffers?</h3>
|
||||||
@ -325,6 +319,9 @@ function's state being torn down after an error, which is sufficient
|
|||||||
to handle catastrophe but requires no extra control structures and,
|
to handle catastrophe but requires no extra control structures and,
|
||||||
when used well, can result in clean error-handling code.
|
when used well, can result in clean error-handling code.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
See the <a href="http://blog.golang.org/2010/08/defer-panic-and-recover.html">Defer, Panic, and Recover</a> article for details.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<h3 id="assertions">
|
<h3 id="assertions">
|
||||||
@ -697,6 +694,10 @@ responsible for a particular piece of data.
|
|||||||
Do not communicate by sharing memory. Instead, share memory by communicating.
|
Do not communicate by sharing memory. Instead, share memory by communicating.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
See the <a href="/doc/codewalk/sharemem/">Share Memory By Communicating</a> code walk and its <a href="http://blog.golang.org/2010/07/share-memory-by-communicating.html">associated article</a> for a detailed discussion of this concept.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3 id="Why_no_multi_CPU">
|
<h3 id="Why_no_multi_CPU">
|
||||||
Why doesn't my multi-goroutine program use multiple CPUs?</h3>
|
Why doesn't my multi-goroutine program use multiple CPUs?</h3>
|
||||||
|
|
||||||
@ -885,6 +886,8 @@ That script finds the <code>Test</code> functions,
|
|||||||
builds a test binary, and runs it.
|
builds a test binary, and runs it.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>See the <a href="/doc/code.html">How to Write Go Code</a> document for more details.</p>
|
||||||
|
|
||||||
|
|
||||||
<h2 id="Implementation">Implementation</h2>
|
<h2 id="Implementation">Implementation</h2>
|
||||||
|
|
||||||
@ -1013,6 +1016,10 @@ is not just the expression grammar; keywords such as <code>func</code>
|
|||||||
and <code>chan</code> keep things clear.
|
and <code>chan</code> keep things clear.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
See the <a href="http://blog.golang.org/2010/07/gos-declaration-syntax.html">Go's Declaration Syntax</a> article for more details.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3 id="no_pointer_arithmetic">
|
<h3 id="no_pointer_arithmetic">
|
||||||
Why is there no pointer arithmetic?</h3>
|
Why is there no pointer arithmetic?</h3>
|
||||||
<p>
|
<p>
|
||||||
|
Loading…
Reference in New Issue
Block a user