Created
April 28, 2016 19:54
-
-
Save vodrazka/0c7e76f793b1082d90b038d2de83f628 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" | |
"reflect" | |
) | |
func main() { | |
var m Foo = MyStruct{"test"} | |
_ = m.DoSmth() | |
fmt.Println() | |
fmt.Println(reflect.TypeOf(m)) | |
fmt.Printf("%T", m) | |
} | |
type Foo interface { | |
DoSmth() string | |
} | |
type MyStruct struct { | |
Data string | |
} | |
func (m MyStruct) DoSmth() string { | |
fmt.Printf("%v", m.Data) | |
return m.Data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment