Update prebuilts to go 1.12.1
From https://ci.android.com/builds/submitted/5389456/darwin_mac/latest/go.zip
Also includes a cherry-pick of
https://github.com/golang/go/commit/ff048033e4304898245d843e79ed1a0897006c6d
Fixes: 126298064
Test: m blueprint_tools
Change-Id: I5b44319547aac0211a7a6248ba7f23dde3cb9116
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 89c1d08..3413186 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -246,14 +246,16 @@
<p>
If every doc comment begins with the name of the item it describes,
-the output of <code>godoc</code> can usefully be run through <code>grep</code>.
+you can use the <a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol">doc</a>
+subcommand of the <a href="/cmd/go/">go</a> tool
+and run the output through <code>grep</code>.
Imagine you couldn't remember the name "Compile" but were looking for
the parsing function for regular expressions, so you ran
the command,
</p>
<pre>
-$ godoc regexp | grep -i parse
+$ go doc -all regexp | grep -i parse
</pre>
<p>
@@ -264,10 +266,10 @@
</p>
<pre>
-$ godoc regexp | grep parse
+$ go doc -all regexp | grep -i parse
Compile parses a regular expression and returns, if successful, a Regexp
+ MustCompile is like Compile but panics if the expression cannot be parsed.
parsed. It simplifies safe initialization of global variables holding
- cannot be parsed. It simplifies safe initialization of global variables
$
</pre>
@@ -1402,11 +1404,11 @@
var err error
for i := 0; i < 32; i++ {
nbytes, e := f.Read(buf[i:i+1]) // Read one byte.
+ n += nbytes
if nbytes == 0 || e != nil {
err = e
break
}
- n += nbytes
}
</pre>
<p>
@@ -1708,7 +1710,7 @@
&{7 -2.35 abc def}
&{a:7 b:-2.35 c:abc def}
&main.T{a:7, b:-2.35, c:"abc\tdef"}
-map[string] int{"CST":-21600, "PST":-28800, "EST":-18000, "UTC":0, "MST":-25200}
+map[string]int{"CST":-21600, "PST":-28800, "EST":-18000, "UTC":0, "MST":-25200}
</pre>
<p>
(Note the ampersands.)
@@ -1731,7 +1733,7 @@
prints
</p>
<pre>
-map[string] int
+map[string]int
</pre>
<p>
If you want to control the default format for a custom type, all that's required is to define
@@ -2104,12 +2106,14 @@
<p>
The <code>String</code> method of <code>Sequence</code> is recreating the
-work that <code>Sprint</code> already does for slices. We can share the
-effort if we convert the <code>Sequence</code> to a plain
+work that <code>Sprint</code> already does for slices.
+(It also has complexity O(N²), which is poor.) We can share the
+effort (and also speed it up) if we convert the <code>Sequence</code> to a plain
<code>[]int</code> before calling <code>Sprint</code>.
</p>
<pre>
func (s Sequence) String() string {
+ s = s.Copy()
sort.Sort(s)
return fmt.Sprint([]int(s))
}
@@ -2136,6 +2140,7 @@
// Method for printing - sorts the elements before printing
func (s Sequence) String() string {
+ s = s.Copy()
sort.IntSlice(s).Sort()
return fmt.Sprint([]int(s))
}
@@ -2762,7 +2767,7 @@
}
</pre>
<p>
-The <code>Job</code> type now has the <code>Log</code>, <code>Logf</code>
+The <code>Job</code> type now has the <code>Print</code>, <code>Printf</code>, <code>Println</code>
and other
methods of <code>*log.Logger</code>. We could have given the <code>Logger</code>
a field name, of course, but it's not necessary to do so. And now, once
@@ -2770,7 +2775,7 @@
log to the <code>Job</code>:
</p>
<pre>
-job.Log("starting now...")
+job.Println("starting now...")
</pre>
<p>
The <code>Logger</code> is a regular field of the <code>Job</code> struct,
@@ -2797,8 +2802,8 @@
which would be useful if we wanted to refine the methods of <code>Logger</code>.
</p>
<pre>
-func (job *Job) Logf(format string, args ...interface{}) {
- job.Logger.Logf("%q: %s", job.Command, fmt.Sprintf(format, args...))
+func (job *Job) Printf(format string, args ...interface{}) {
+ job.Logger.Printf("%q: %s", job.Command, fmt.Sprintf(format, args...))
}
</pre>
<p>