Let me explain with an example, For goquery, most functions are of type "func (s *Selection) Xxx(selector string) *Selection". For e.g., "Find" is:
func (s *Selection <https://godoc.org/github.com/PuerkitoBio/goquery#Selection>) Find(selector string <https://godoc.org/builtin#string>) *Selection <https://godoc.org/github.com/PuerkitoBio/goquery#Selection> What's the simplest way for me to define my own function of such type, which can be used as a replacement for them. E.g., for a code like, post_url, _ := doc.Find(".thing").Find(".comments.may-blank").Attr("href") How to define my own function func *FindUrl*() { return goquery.Find(".thing").Find(".comments.may-blank").Attr("href"); } so that the above code can be simplified as: post_url, _ := doc.*FindUrl*() ? Or, is it possible to define FindUrlN() as "goquery.Find(".thing").Find(".comments.may-blank")", so that I can do this: post_url, _ := doc.FindUrlN().Attr("href") ? Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.