From 4f0ceb5e5d9dfcaa9113f7768f3956d034ea538c Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 7 Dec 2015 12:23:42 -0500 Subject: [PATCH] Update to gobook@4fdc3c0a831c14c716c2c013e42268f6d21a9a13 Change-Id: I63623453205b84eba5680e27f68e81e99e7bbeb9 --- ch12/display/display_test.go | 18 +++++++++--------- ch13/equal/equal_test.go | 4 ++-- ch2/tempconv0/tempconv_test.go | 4 ++-- ch4/treesort/sort_test.go | 2 +- ch6/intset/intset_test.go | 4 ++-- ch7/eval/eval_test.go | 2 +- ch7/eval/parse.go | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ch12/display/display_test.go b/ch12/display/display_test.go index 2bd9065..bc847ce 100644 --- a/ch12/display/display_test.go +++ b/ch12/display/display_test.go @@ -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 diff --git a/ch13/equal/equal_test.go b/ch13/equal/equal_test.go index 7dcc0d9..4656077 100644 --- a/ch13/equal/equal_test.go +++ b/ch13/equal/equal_test.go @@ -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 { diff --git a/ch2/tempconv0/tempconv_test.go b/ch2/tempconv0/tempconv_test.go index e8081d3..5337d90 100644 --- a/ch2/tempconv0/tempconv_test.go +++ b/ch2/tempconv0/tempconv_test.go @@ -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" diff --git a/ch4/treesort/sort_test.go b/ch4/treesort/sort_test.go index f033e8f..bf0cb02 100644 --- a/ch4/treesort/sort_test.go +++ b/ch4/treesort/sort_test.go @@ -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) } } diff --git a/ch6/intset/intset_test.go b/ch6/intset/intset_test.go index 2a9bd26..620a39e 100644 --- a/ch6/intset/intset_test.go +++ b/ch6/intset/intset_test.go @@ -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) diff --git a/ch7/eval/eval_test.go b/ch7/eval/eval_test.go index e82ba36..88905cd 100644 --- a/ch7/eval/eval_test.go +++ b/ch7/eval/eval_test.go @@ -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) } } diff --git a/ch7/eval/parse.go b/ch7/eval/parse.go index e5f82fa..677e9a0 100644 --- a/ch7/eval/parse.go +++ b/ch7/eval/parse.go @@ -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)) } }