2

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.

Blaszard
  • 30,954
  • 51
  • 153
  • 233
  • Isn't the html package available as just `html` now? Presumably it was only in the experimental directory when its API wasn't as stable. – James Henstridge Sep 19 '13 at 07:18

2 Answers2

4

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.

Intermernet
  • 18,604
  • 4
  • 49
  • 61
  • See [VonC's answer](http://stackoverflow.com/a/26773535/55504) for the current location (code.google.com is shutting down). – Dave C May 25 '15 at 21:05
1

With go 1.4 (November 9th, 2014), you will have to type:

go get golang.org/x/net/html

See:

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250