Skip to content

Instantly share code, notes, and snippets.

@duguying
Created May 17, 2016 06:03
Show Gist options
  • Save duguying/52edf7cf014882bf2c7a9aacd3d118e4 to your computer and use it in GitHub Desktop.
Save duguying/52edf7cf014882bf2c7a9aacd3d118e4 to your computer and use it in GitHub Desktop.
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