Analysis updated 2026-06-24
Scrape titles and links from an HTML page using jQuery-style CSS selectors
Walk a Selection with EachIter and Go range syntax to process matched nodes
Rewrite a parsed HTML document with AppendHtml or AfterHtml and Render the result to an io.Writer
Pre-compile a cascadia selector once and reuse it across many goquery calls for speed
| puerkitobio/goquery | hoanhan101/ultimate-go | loft-sh/devpod | |
|---|---|---|---|
| Stars | 14,938 | 14,910 | 14,900 |
| Language | Go | Go | Go |
| Setup difficulty | easy | easy | moderate |
| Complexity | 2/5 | 1/5 | 3/5 |
| Audience | developer | developer | ops devops |
Figures from each repo's GitHub metadata at analysis time.
Input must be UTF-8 and goquery v1.12 requires Go 1.25+, so older Go toolchains need an older goquery release.
goquery is a Go library for reading and manipulating HTML documents using a syntax taken from jQuery, the long-popular JavaScript library for browser scripting. The README's tagline calls it "a little like that j-thing, only in Go." If you know jQuery, you can use familiar selector strings like #id.class, or div > a to find parts of an HTML page, then chain methods on the result to read attributes, change text, or rearrange elements. The library is widely used in Go for scraping and parsing HTML. Internally, goquery is built on top of Go's standard net/html parser and a separate library called cascadia, which handles the CSS-selector matching. The README notes one consequence of this choice: net/html only returns a node tree rather than a full browser-style DOM, so jQuery's stateful methods that depend on layout, like height() and css(), are not provided. Another constraint is that net/html requires UTF-8 input, so callers have to convert other encodings before handing the HTML to goquery, the project wiki points to options for this. The README is mostly an installation section and a long changelog. Required Go versions have moved up over time: version 1.12.0 of goquery needs Go 1.25 or newer, version 1.11.0 needs Go 1.24 or newer, and earlier versions trace back through 1.23, 1.18, and 1.1, with the recent jumps driven by dependency updates and the adoption of generics and iterator functions. The author tests against the latest two Go releases. Installation is the usual go get of the package, with optional commands shown for running unit tests and benchmarks. The changelog entries also describe how the API has grown. Highlights from the README include a generic Map function, an EachIter method that exposes a Selection as a Go range iterator, a Render function that writes a Selection back to an io.Writer, Single and SingleMatcher helpers for first-match selection, parsing HTML in the context of the container node for methods like AppendHtml and AfterHtml, and an AttrOr helper that returns a default when an attribute is missing. A note states that the API is now considered stable and will not break. The README also mentions Matcher-based variants of the selector methods, which accept a pre-compiled cascadia selector so callers can handle compilation errors directly and reuse compiled selectors.
goquery brings jQuery-style CSS selectors and chaining to Go for reading and manipulating HTML documents, built on net/html and the cascadia selector engine.
Mainly Go. The stack also includes Go, net/html, cascadia.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.