mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 04:48:29 +08:00
@@ -50,7 +50,7 @@ Go 编程语言的维基百科:[en.wikipedia.org/wiki/Go_(programming_language
|
|||||||
|
|
||||||
Go 语言相关资源的搜索引擎页面:[gowalker.org](https://gowalker.org)
|
Go 语言相关资源的搜索引擎页面:[gowalker.org](https://gowalker.org)
|
||||||
|
|
||||||
Go 语言还有一个运行在 Google App Engine 上的 [Go Tour](http://tour.golang.org/),你也可以通过执行命令 `go install go-tour.googlecode.com/hg/gotour` 安装到你的本地机器上。对于中文读者,可以访问该指南的 [中文版本](http://go-tour-zh.appsp0t.com/),或通过命令 `go install https://bitbucket.org/mikespook/go-tour-zh/gotour` 进行安装。
|
Go 语言还有一个运行在 Google App Engine 上的 [Go Tour](http://tour.golang.org/),你也可以通过执行命令 `go install go-tour.googlecode.com/hg/gotour` 安装到你的本地机器上。对于中文读者,可以访问该指南的 [中文版本](http://go-tour-zh.appspot.com/),或通过命令 `go install https://bitbucket.org/mikespook/go-tour-zh/gotour` 进行安装。
|
||||||
|
|
||||||
## 链接
|
## 链接
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ type HandlerFunc func(ResponseWriter, *Request)
|
|||||||
```
|
```
|
||||||
它是一个可以把普通的函数当做HTTP处理器的适配器。如果`f`函数声明的合适,`HandlerFunc(f)`就是一个执行了`f`函数的处理器对象。
|
它是一个可以把普通的函数当做HTTP处理器的适配器。如果`f`函数声明的合适,`HandlerFunc(f)`就是一个执行了`f`函数的处理器对象。
|
||||||
|
|
||||||
`http.Handle`的第二个参数也可以是`T`的一个obj对象:`http.Handle("/", obj)`给T提供了`SereHTTP`方法,实现了http的`Handler`接口:
|
`http.Handle`的第二个参数也可以是`T`的一个obj对象:`http.Handle("/", obj)`给T提供了`ServeHTTP`方法,实现了http的`Handler`接口:
|
||||||
```go
|
```go
|
||||||
func (obj *Typ) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
func (obj *Typ) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
...
|
...
|
||||||
|
Reference in New Issue
Block a user