Commit 3c26beb9 authored by Go101's avatar Go101

small improvements

parent 3cc77c8d
......@@ -2,7 +2,7 @@
<p>
<i>Go 101</i> is a book focusing on Go syntax/semantics
and all kinds of details (Go 1.12 ready).
and all kinds of details (Go 1.13-pre ready).
This book also tries to help gophers gain a deep and thorough understanding of Go.
It is expected that this book is helpful for both beginner and experienced Go programmers.
</p>
......
......@@ -82,7 +82,7 @@ So the size of the <code>uint32</code> type is four bytes.
</p>
<p>
The size of <code>uintptr</code, <code>int</code> and <code>uint</code> values
The size of <code>uintptr</code>, <code>int</code> and <code>uint</code> values
n memory are implementation-specific.
Generally, The size of <code>int</code> and <code>uint</code> values
are 4 on 32-bit architectures, and 8 on 64-bit architectures.
......
......@@ -359,7 +359,7 @@ func main() {
</p>
<p>
In fact 2, there are no fundamental differences between
In fact, there are no fundamental differences between
receiving or sending values to make notifications.
It is just that the slowers notify the fasters waiting for notifications.
</p>
......@@ -1260,7 +1260,7 @@ import "fmt"
import "time"
func Tick(d time.Duration) <-chan struct{} {
// The capacity of c must be exactly one.
// The capacity of c is best set as one.
c := make(chan struct{}, 1)
go func() {
for {
......
......@@ -393,7 +393,8 @@ The last two rules are to ensure both readers and writers have chances to acquir
</p>
<p>
Please note, a lock acquirer might be not the holder of the lock it acquired.
Please note, locks are bound to goroutines. In other words,
a lock acquirer might be not the holder of the lock it acquired.
In other words, a lock doesn't know which goroutine acquired it,
and any goroutine can release a lock which in acquired status.
</p>
......
......@@ -391,19 +391,17 @@ func main() {
</code></pre>
</div>
<h3>Generic</h3>
<h3>Function Parameters</h3>
<div>
The basic rule:
<div class="alert alert-info">
Go doesn't support generic.
Each parameter is a value of some type.
</div>
Exception:
<div class="alert alert-success">
Most built-in functions, which declared in the <code>builtin</code> and <code>unsafe</code>
standard packages, support generic.
And type compositions with all kinds of composite types in Go is kinda of generic.
The first parameters of the built-in <code>make</code> and <code>new</code> functions are types.
</div>
</div>
......
......@@ -547,7 +547,7 @@ Currently (Go 1.12), for the standard Go compiler,
<li>you can add a line <code>//go:noinline</code> directive before a function declaration to avoid the function being inlined.</li>
<li><span style="text-decoration:line-through;">as functions containing loop blocks will not be inlined,
you can add a <code>for false {}</code> line in a function to avoid the function being inlined.</span>
(This way may become invalid <a href="https://github.com/golang/go/issues/14768">since Go 1.12</a>.)
(This way may become invalid <a href="https://github.com/golang/go/issues/14768">since Go 1.14</a>.)
</li>
</ol>
</li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment