doc, err := goquery.NewDocument("http://example.com") if err != nil { log.Fatal(err) }
doc.Find("a").Each(func(index int, item *goquery.Selection) { link, exists := item.Attr("href") if exists { fmt.Println(index, link) } })In this example, we are using the `Find` method to select all `a` elements on the page. We then iterate over each selection using the `Each` method and extract the value of the `href` attribute using the `Attr` method. Overall, `github.com/puerkitobio/goquery` is a useful package for parsing and querying HTML documents in Go.