Skip to content

Instantly share code, notes, and snippets.

@karlmutch
Created July 14, 2015 21:03
Show Gist options
  • Select an option

  • Save karlmutch/bdc597bf20f5a94a2130 to your computer and use it in GitHub Desktop.

Select an option

Save karlmutch/bdc597bf20f5a94a2130 to your computer and use it in GitHub Desktop.
var (
Web = fakeSearch("web")
Image = fakeSearch("image")
Video = fakeSearch("video")
)
type Search func(query string) Result
func fakeSearch(kind string) Search {
return func(query string) Result {
time.Sleep(time.Duration(rand.Intn(100)) * time.Millisecond)
return Result(fmt.Sprintf("%s result for %q\n", kind, query))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment