removed all the footers; formated all the files

This commit is contained in:
Oling Cat
2012-11-01 16:10:44 +08:00
parent 77b8677ae0
commit c059171e15
73 changed files with 4576 additions and 4782 deletions

12
11.1.md
View File

@@ -6,9 +6,9 @@ Go语言设计的时候主要的特点是简洁、明白简洁是指语法
下面这个例子通过`os.Open`打开一个文件,如果出错那么会执行`log.Fatal`打印出来错误信息:
f, err := os.Open("filename.ext")
if err != nil {
log.Fatal(err)
}
if err != nil {
log.Fatal(err)
}
其实这样的error返回在Go语言的很多内置包里面有很多我们这个小节将详细的介绍这些error是怎么设计的以及在我们设计的Web应用如何更好的处理error。
## Error类型
@@ -35,14 +35,14 @@ error是一个内置的类型变量我们可以在/builtin/包下面找到相
return &errorString{text}
}
下面这个例子演示了如何使用`errors.New`:
下面这个例子演示了如何使用`errors.New`:
func Sqrt(f float64) (float64, error) {
if f < 0 {
return 0, errors.New("math: square root of negative number")
}
// implementation
}
}
## 自定义Error
@@ -53,4 +53,4 @@ error是一个内置的类型变量我们可以在/builtin/包下面找到相
## links
* [目录](<preface.md>)
* 上一节: [错误处理,调试和测试](<11.md>)
* 下一节: [使用GDB调试](<11.2.md>)
* 下一节: [使用GDB调试](<11.2.md>)