Skip to content

Commit

Permalink
Fix a code error in example
Browse files Browse the repository at this point in the history
Should be `err.Error()` rather than `err.String()` which is not existed
  • Loading branch information
bachue committed Aug 9, 2014
1 parent 9cd9482 commit 8805746
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go-communication.tex
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ \section{网络}

func main() {
r, err := http.Get("http://www.google.com/robots.txt") |\longremark{使用 http 的 \func{Get} 获取 html;}|
if err != nil { fmt.Printf("%s\n", err.String()); return } |\longremark{错误处理;}|
if err != nil { fmt.Printf("%s\n", err.Error()); return } |\longremark{错误处理;}|
b, err := ioutil.ReadAll(r.Body) |\longremark{将整个内容读入 \var{b};}|
r.Body.Close()
if err == nil { fmt.Printf("%s", string(b)) } |\longremark{如果一切 OK 的话,打印内容。}|
Expand Down

0 comments on commit 8805746

Please sign in to comment.