Created
May 17, 2016 06:03
-
-
Save duguying/52edf7cf014882bf2c7a9aacd3d118e4 to your computer and use it in GitHub Desktop.
This file contains 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 ( | |
"fmt" | |
"github.com/codegangsta/inject" | |
) | |
type SpecialString interface{} | |
func Say(name string, gender SpecialString, age int) { | |
fmt.Printf("My name is %s, gender is %s, age is %d!\n", name, gender, age) | |
} | |
func main() { | |
inj := inject.New() | |
inj.Map("陈一回") | |
inj.MapTo("男", (*SpecialString)(nil)) | |
inj.Map(20) | |
inj.Invoke(Say) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment