Last active
July 3, 2020 12:37
-
-
Save bykof/edeafe2320817cd8e4e540a63c0806f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"example.com/dingo_example" | |
"example.com/dingo_example/interfaces" | |
"flamingo.me/dingo" | |
"log" | |
) | |
func main() { | |
injector, err := dingo.NewInjector(new(dingo_example.Module)) | |
if err != nil { | |
panic(err) | |
} | |
// Now that we've got the injector, we can build objects. | |
// We get a new instance, and cast it accordingly: | |
instance, err := injector.GetInstance(new(interfaces.AppController)) | |
if err != nil { | |
log.Fatal(err) | |
} | |
appController := instance.(*interfaces.AppController) | |
appController.PrintProducts() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment