goquery - a little like that j-thing, only in Go
GoQuery brings a syntax and features similar to jQuery to the Go language. It is based on the experimental html package and the CSS Selector library cascadia. Since the html parser returns tokens (nodes), and not a full-featured DOM object, jQuery's manipulation and modification functions have been left off (no point in modifying data in the parsed tree of the HTML, it has no effect).
Supported functions are (will be) query-oriented features (hasClass(), attr() and the likes), as well as traversing functions that make sense given what we have to work with.
Syntax-wise, it is as close as possible to jQuery, with the same function names when possible, and that warm and fuzzy chainable interface.
Installation
Since this library (and cascadia) depends on the experimental branch, this package must be installed first. Both GoQuery and Cascadia expect to find the experimental library with the "exp/html" import statement. To install it at this location, please follow this guide.
Once this is done, install GoQuery:
go get github.com/PuerkitoBio/goquery
API
GoQuery exposes two classes, Document and Selection. Unlike jQuery, which is loaded as part of a DOM document, and thus acts on its containing document, GoQuery doesn't know which HTML document to act upon. So it needs to be told, and that's what the Document class is for. It holds the root document node to manipulate, and can make selections on this document.
Please note that Cascadia's selectors do NOT necessarily match all supported selectors of jQuery (Sizzle). See the cascadia project for details.
(reference coming soon)
License
The BSD 3-Clause license, the same as the Go language. Cascadia's license is here.