package extractor type Documents []Document func (d Documents) Select(selector string) Documents { var res Documents for _, doc := range d { res = append(res, doc.Select(selector)...) } return res } func (d Documents) First() Document { return d[0] } func (d Documents) ExtractText() ([]string, error) { var res []string for _, doc := range d { text, err := doc.Text() if err != nil { return nil, err } res = append(res, text) } return res, nil }