Skip to content

Instantly share code, notes, and snippets.

@adnaan
Created July 7, 2017 03:42
Show Gist options
  • Save adnaan/74dd54b26cfd275cbd26ecb877d125b0 to your computer and use it in GitHub Desktop.
Save adnaan/74dd54b26cfd275cbd26ecb877d125b0 to your computer and use it in GitHub Desktop.
Global Dependency
package main
// Using a global dependency
var userService user.Service
func Init() {
userService = user.NewService()
}
func GetComments() []Comment {
var comments []Comment
comments = append(comments, userService.GetComments())
return comments
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment