doc, _ := goquery.NewDocument("https://www.example.com") doc.Find("a").Each(func(i int, s *goquery.Selection) { link, _ := s.Attr("href") fmt.Println(link) })
doc, _ := goquery.NewDocumentFromReader(strings.NewReader(htmlString)) doc.Find("input.my-class").Each(func(i int, s *goquery.Selection) { value, exists := s.Attr("value") if exists { fmt.Println(value) } })The package library used here is "github.com/puerkitobio/goquery".