Skip to content

Instantly share code, notes, and snippets.

@lysu
Last active March 7, 2016 16:38
Show Gist options
  • Save lysu/6dfcc39e10f0156c5255 to your computer and use it in GitHub Desktop.
Save lysu/6dfcc39e10f0156c5255 to your computer and use it in GitHub Desktop.
/* start prcess/process.go */
package process
var fetch Fetch = fetch.NewHttpFetch() // as Gobal field
// or someone like this..
// func int() {
// fetch = fetch.NewHttpFetch()
// }
func Process(x string) {
fetch.Fetch(x)
}
/* end prcess/process.go */
/* start fetch/fetch.go */
package fetch
type Fetch interface {
Fetch(x string)
}
type httpFetch struct {
}
// ............
func NewHttpFetch() Fetch {
return &httpFetch
}
/* end fetch/fetch.go */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment