diff --git a/eBook/06.9.md b/eBook/06.9.md index f852900..1930f97 100644 --- a/eBook/06.9.md +++ b/eBook/06.9.md @@ -117,8 +117,8 @@ func MakeAddSuffix(suffix string) func(string) string { 现在,我们可以生成如下函数: ```go -addBmp := MakeAddSuffix(“.bmp”) -addJpeg := MakeAddSuffix(“.jpeg”) +addBmp := MakeAddSuffix(".bmp") +addJpeg := MakeAddSuffix(".jpeg") ``` 然后调用它们: diff --git a/eBook/09.5.md b/eBook/09.5.md index 06ba89b..de388b0 100644 --- a/eBook/09.5.md +++ b/eBook/09.5.md @@ -65,7 +65,7 @@ func main() { 下面的代码试图访问一个未引用的变量或者函数,甚至没有编译。将会返回一个错误: ```go -fmt.Printf(“Float from package1: %f\n”, pack1.pack1Float) +fmt.Printf("Float from package1: %f\n", pack1.pack1Float) ``` 错误: diff --git a/eBook/13.0.md b/eBook/13.0.md index b9b4d59..ad84690 100644 --- a/eBook/13.0.md +++ b/eBook/13.0.md @@ -22,7 +22,7 @@ Go 是怎么处理普通错误的呢?通过在函数和方法中返回错误 ```go if value, err := pack1.Func1(param1); err != nil { - fmt.Printf(“Error %s in pack1.Func1 with parameter %v”, err.Error(), param1) + fmt.Printf("Error %s in pack1.Func1 with parameter %v", err.Error(), param1) return // or: return err } else { // Process(value) diff --git a/eBook/13.5.md b/eBook/13.5.md index 7d6fb89..84fd2df 100644 --- a/eBook/13.5.md +++ b/eBook/13.5.md @@ -35,7 +35,7 @@ func errorHandler(fn fType1) fType1 { return func(a type1, b type2) { defer func() { if err, ok := recover().(error); ok { - log.Printf(“run time panic: %v”, err) + log.Printf("run time panic: %v", err) } }() fn(a, b) diff --git a/eBook/13.8.md b/eBook/13.8.md index 3aeff4f..6f744dc 100644 --- a/eBook/13.8.md +++ b/eBook/13.8.md @@ -101,7 +101,7 @@ include $(GOROOT)/src/Make.pkg ```go func TestEven(t *testing.T) { if Even(10) { - t.Log(“Everything OK: 10 is even, just a test to see failed output!”) + t.Log("Everything OK: 10 is even, just a test to see failed output!") t.Fail() } } diff --git a/eBook/13.9.md b/eBook/13.9.md index cd7b565..c74fb85 100644 --- a/eBook/13.9.md +++ b/eBook/13.9.md @@ -12,9 +12,9 @@ var tests = []struct{ // Test table out string }{ - {“in1”, “exp1”}, - {“in2”, “exp2”}, - {“in3”, “exp3”}, + {"in1", "exp1"}, + {"in2", "exp2"}, + {"in3", "exp3"}, ... } @@ -22,7 +22,7 @@ func TestFunction(t *testing.T) { for i, tt := range tests { s := FuncToBeTested(tt.in) if s != tt.out { - t.Errorf(“%d. %q => %q, wanted: %q”, i, tt.in, s, tt.out) + t.Errorf("%d. %q => %q, wanted: %q", i, tt.in, s, tt.out) } } }