From: Robert Griesemer
Date: Fri, 31 Jul 2015 18:15:11 +0000 (-0700)
Subject: spec: fixed various example code snippets
X-Git-Tag: go1.5rc1~56
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=02d74485e41feadd2dd98edce3416eda57168772;p=gostls13.git
spec: fixed various example code snippets
Per suggestions by Peter Olsen (https://github.com/pto).
Fixes #11964.
Change-Id: Iae261ac14f75abf848f5601f59d7fe6e95b6805a
Reviewed-on: https://go-review.googlesource.com/13006
Reviewed-by: Ian Lance Taylor
---
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 14fa44c675..658891e08f 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -1918,7 +1918,7 @@ const (
)
func (tz TimeZone) String() string {
- return fmt.Sprintf("GMT+%dh", tz)
+ return fmt.Sprintf("GMT%+dh", tz)
}
@@ -2050,13 +2050,13 @@ a terminating statement.
-func findMarker(c <-chan int) int {
- for i := range c {
- if x := <-c; isMarker(x) {
- return x
+func IndexRune(s string, r rune) int {
+ for i, c := range s {
+ if c == r {
+ return i
}
}
- // invalid: missing return statement.
+ // invalid: missing return statement
}
@@ -2598,9 +2598,10 @@ p.x // (*(*p).T0).x
q.x // (*(*q).T0).x (*q).x is a valid field selector
-p.M2() // p.M2() M2 expects *T2 receiver
+p.M0() // ((*p).T0).M0() M0 expects *T0 receiver
p.M1() // ((*p).T1).M1() M1 expects T1 receiver
-p.M0() // ((&(*p).T0)).M0() M0 expects *T0 receiver, see section on Calls
+p.M2() // p.M2() M2 expects *T2 receiver
+t.M2() // (&t).M2() M2 expects *T2 receiver, see section on Calls