英文:
Install exp/html in Go
问题
看起来Go目前还不支持HTML网页解析工具/包,尽管它已经通过encoding/xml
提供了XML抓取功能。那么我该如何在Go中安装exp/html
包呢?
据我所知,所有的答案,至少在我进行了10分钟的搜索后遇到的,都没有给出正确的答案;当我尝试运行它们时,我得到了错误信息cannot find package XXX in YYY
或no Go source files in XXX
。
所以,目前是否可以在不重新编译和从头设置整个Go环境的情况下安装它?或者我漏掉了什么?
我使用的是OS X 10.8,并运行Go版本1.1,这是我通过OS X软件包安装程序安装的。
供您参考,以下代码没有成功:
go get code.google.com/p/go/src/pkg/exp/html
go get code.google.com/p/go.exp/inotify
谢谢。
英文:
It looks like Go doesn't support HTML web parsing tools/packages yet, despite it already providing XML scraping via encoding/xml
. So how can I install exp/html
package in Go?
As far as I know, all the answers, at least I stumbled upon on the Web with 10 minutes worth of searching, didn't return the correct answer; when I tried to run those, I got the error cannot find package XXX in YYY
or no Go source files in XXX
.
So as of now, can I install it without re-compling and setting the whole Go environment from scratch? Or am I missing something?
I'm on OS X 10.8 and run Go version 1.1, which I installed from OS X package installer.
For your information, these code didn't make it.
go get code.google.com/p/go/src/pkg/exp/html
go get code.google.com/p/go.exp/inotify
Thanks.
答案1
得分: 4
我刚刚尝试了:
go get code.google.com/p/go.net/html
看起来好像可以工作。
我有一种感觉它已经从exp
库移动到了新的net
库。
英文:
I just tried:
go get code.google.com/p/go.net/html
and it seemed to work.
I have a feeling it's been moved from the exp
library to the new net
library.
EDIT: Documentation & browseable repo.
答案2
得分: 1
在Go 1.4(2014年11月9日)中,您需要输入以下命令:
go get golang.org/x/net/html
参考链接:
-
"Go子仓库的新导入路径"。
-
"Go 1.4子仓库重命名"。
英文:
With go 1.4 (November 9th, 2014), you will have to type:
go get golang.org/x/net/html
See:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论