diff --git a/eBook/09.11.md b/eBook/09.11.md index d5d2303..2f1fdde 100644 --- a/eBook/09.11.md +++ b/eBook/09.11.md @@ -15,14 +15,14 @@ 我们将通过在终端调用以下命令来安装 API: - go install google-api-go-client.google.com/hg/urlshortener/v1 + go install google.golang.org/api/urlshortener/v1 go install 将下载源码,编译并安装包 使用 urlshortener 服务的 web 程序: 现在我们可以通过导入并赋予别名来使用已安装的包: - import urlshortener "google-api-go-client.googlecode.com/hg/urlshortener/v1" + import "google.golang.org/api/urlshortener/v1" 现在我们写一个 Web 应用(参见第 15 章 4-8 节)通过表单实现短地址和长地址的相互转换。我们将使用 `template` 包并写三个处理函数:root 函数通过执行表单模板来展示表单。short 函数将长地址转换为短地址,long 函数逆向转换。 @@ -57,7 +57,7 @@ import ( "net/http" "text/template" - urlshortener "google-api-go-client.googlecode.com/hg/urlshortener/v1" + "google.golang.org/api/urlshortener/v1" ) func main() { http.HandleFunc("/", root) @@ -123,8 +123,8 @@ func long(w http.ResponseWriter, r *http.Request) { 创建一个和包同名的目录 `urlshort`,并将以下两个安装目录复制到这个目录: - google-api-go-client.googlecode.com/hg/urlshortener - google-api-go-client.googlecode.com/hg/google-api + google.golang.org/api/urlshortener + google.golang.org/api/googleapi 此外还要配置下配置文件 `app.yaml`,内容如下: