From 8920b4102ee5840fb283b6c67fdb14fadda8e553 Mon Sep 17 00:00:00 2001 From: Yue Chen Date: Tue, 10 Dec 2019 16:05:07 +0800 Subject: [PATCH] Update ch5-08.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改输出 --- ch5/ch5-08.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch5/ch5-08.md b/ch5/ch5-08.md index d4ef049..03f3989 100644 --- a/ch5/ch5-08.md +++ b/ch5/ch5-08.md @@ -41,7 +41,7 @@ The Go Programming Language $ ./title1 https://golang.org/doc/effective_go.html Effective Go - The Go Programming Language $ ./title1 https://golang.org/doc/gopher/frontpage.png -title: https://golang.org/doc/gopher/frontpage.png has type image/png, not text/html +title1: https://golang.org/doc/gopher/frontpage.png has type image/png, not text/html ``` resp.Body.close调用了多次,这是为了确保title在所有执行路径下(即使函数运行失败)都关闭了网络连接。随着函数变得复杂,需要处理的错误也变多,维护清理逻辑变得越来越困难。而Go语言独有的defer机制可以让事情变得简单。