Skip to content

Commit

Permalink
修改翻译错误
Browse files Browse the repository at this point in the history
  • Loading branch information
themoonbear committed Apr 20, 2019
1 parent 66964c0 commit 6e2f2e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eBook/chapter10/10.7.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

使用 `useContext.go` 程序代码将更好,更深入的说明 `context` 包的功能,该代码分为五部分来介绍。

这个例子中,您将创建一个不想等待太长时间服务器响应的 HTTP 客户端,这是一个不常见的场景。事实上,几乎所有的 HTTP 客户端都支持这个功能,您将学习另一个 HTTP 请求超时的技巧,在[第12章](https://github.com/hantmac/Mastering_Go_ZH_CN/tree/master/eBook/chapter12/12.0.md)(Go网络编程基础)。
这个例子中,您将创建一个快速响应的 HTTP 客户端,这是一个很常见的需求。事实上,几乎所有的 HTTP 客户端都支持这个功能,您将学习另一个 HTTP 请求超时的技巧,在[第12章](https://github.com/hantmac/Mastering_Go_ZH_CN/tree/master/eBook/chapter12/12.0.md)(Go网络编程基础)。

`useContext.go` 程序需要两个命令行参数:要连接的服务器 URL 和应该等待的延迟。如果该程序只有一个命名行参数,那么延迟将是 5 秒。

Expand Down Expand Up @@ -34,7 +34,7 @@ type myData struct {
}
```

`myUrl``delay` 都是全局变量,因此它们能从代码的任意位置访问。另外,有一个名为 `w``sync..WaitGroup` 变量也是全局的,还有一个名为 `myData` 的结构体用于把 web 服务器的响应和一个防备某处发生错误的错误变量绑在一起
`myUrl``delay` 都是全局变量,因此它们能从代码的任意位置访问。另外,有一个名为 `w``sync..WaitGroup` 变量也是全局的,还有一个名为 `myData` 的结构体用于把 web 服务器的响应和一个错误变量绑在一起

`useContext.go` 的第二部分代码如下:

Expand Down

0 comments on commit 6e2f2e9

Please sign in to comment.