Update to gobook@4fdc3c0a831c14c716c2c013e42268f6d21a9a13

Change-Id: I63623453205b84eba5680e27f68e81e99e7bbeb9
This commit is contained in:
Alan Donovan 2015-12-07 12:23:42 -05:00
parent b7e11892d0
commit 4f0ceb5e5d
7 changed files with 18 additions and 18 deletions

View File

@ -19,7 +19,7 @@ import (
// which requires the // Output comment to be at the end
// of the function.
func ExampleExpr() {
func Example_expr() {
e, _ := eval.Parse("sqrt(A / pi)")
Display("e", e)
// Output:
@ -33,7 +33,7 @@ func ExampleExpr() {
// e.args[0].value.y.value = "pi"
}
func ExampleSlice() {
func Example_slice() {
Display("slice", []*int{new(int), nil})
// Output:
// Display slice ([]*int):
@ -41,7 +41,7 @@ func ExampleSlice() {
// slice[1] = nil
}
func ExampleNilInterface() {
func Example_nilInterface() {
var w io.Writer
Display("w", w)
// Output:
@ -49,7 +49,7 @@ func ExampleNilInterface() {
// w = invalid
}
func ExamplePtrToInterface() {
func Example_ptrToInterface() {
var w io.Writer
Display("&w", &w)
// Output:
@ -57,7 +57,7 @@ func ExamplePtrToInterface() {
// (*&w) = nil
}
func ExampleStruct() {
func Example_struct() {
Display("x", struct{ x interface{} }{3})
// Output:
// Display x (struct { x interface {} }):
@ -65,7 +65,7 @@ func ExampleStruct() {
// x.x.value = 3
}
func ExampleInterface() {
func Example_interface() {
var i interface{} = 3
Display("i", i)
// Output:
@ -73,7 +73,7 @@ func ExampleInterface() {
// i = 3
}
func ExamplePtrToInterface2() {
func Example_ptrToInterface2() {
var i interface{} = 3
Display("&i", &i)
// Output:
@ -82,7 +82,7 @@ func ExamplePtrToInterface2() {
// (*&i).value = 3
}
func ExampleArray() {
func Example_array() {
Display("x", [1]interface{}{3})
// Output:
// Display x ([1]interface {}):
@ -90,7 +90,7 @@ func ExampleArray() {
// x[0].value = 3
}
func ExampleMovie() {
func Example_movie() {
//!+movie
type Movie struct {
Title, Subtitle string

View File

@ -93,7 +93,7 @@ func TestEqual(t *testing.T) {
}
}
func ExampleEqual() {
func Example_equal() {
//!+
fmt.Println(Equal([]int{1, 2, 3}, []int{1, 2, 3})) // "true"
fmt.Println(Equal([]string{"foo"}, []string{"bar"})) // "false"
@ -108,7 +108,7 @@ func ExampleEqual() {
// true
}
func ExampleEqualCycle() {
func Example_equalCycle() {
//!+cycle
// Circular linked lists a -> b -> a and c -> c.
type link struct {

View File

@ -5,7 +5,7 @@ package tempconv
import "fmt"
func Example1() {
func Example_one() {
{
//!+arith
fmt.Printf("%g\n", BoilingC-FreezingC) // "100" °C
@ -24,7 +24,7 @@ func Example1() {
// 180
}
func Example2() {
func Example_two() {
//!+printf
c := FToC(212.0)
fmt.Println(c.String()) // "100°C"

View File

@ -18,6 +18,6 @@ func TestSort(t *testing.T) {
}
treesort.Sort(data)
if !sort.IntsAreSorted(data) {
t.Errorf("not sorted: %s", data)
t.Errorf("not sorted: %v", data)
}
}

View File

@ -5,7 +5,7 @@ package intset
import "fmt"
func Example1() {
func Example_one() {
//!+main
var x, y IntSet
x.Add(1)
@ -30,7 +30,7 @@ func Example1() {
// true false
}
func Example2() {
func Example_two() {
var x IntSet
x.Add(1)
x.Add(144)

View File

@ -43,7 +43,7 @@ func TestEval(t *testing.T) {
got := fmt.Sprintf("%.6g", expr.Eval(test.env))
fmt.Printf("\t%v => %s\n", test.env, got)
if got != test.want {
t.Errorf("%s.Eval() in %s = %q, want %q\n",
t.Errorf("%s.Eval() in %v = %q, want %q\n",
test.expr, test.env, got, test.want)
}
}

View File

@ -130,7 +130,7 @@ func parsePrimary(lex *lexer) Expr {
lex.next() // consume ','
}
if lex.token != ')' {
msg := fmt.Sprintf("got %s, want ')'", lex.token)
msg := fmt.Sprintf("got %q, want ')'", lex.token)
panic(lexPanic(msg))
}
}