修改标点错误 (#494)

This commit is contained in:
xin zhao
2018-05-28 20:37:33 +08:00
committed by 无闻
parent 81285ba80c
commit 7854ee57e0
6 changed files with 10 additions and 10 deletions

View File

@@ -117,8 +117,8 @@ func MakeAddSuffix(suffix string) func(string) string {
现在,我们可以生成如下函数:
```go
addBmp := MakeAddSuffix(.bmp)
addJpeg := MakeAddSuffix(.jpeg)
addBmp := MakeAddSuffix(".bmp")
addJpeg := MakeAddSuffix(".jpeg")
```
然后调用它们:

View File

@@ -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)
```
错误:

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()
}
}

View File

@@ -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)
}
}
}