📅  最后修改于: 2022-03-11 14:45:00.887000             🧑  作者: Mango
type Person struct {
firstName string
lastName string
}
func printIfPerson(object interface{}) {
person, ok := object.(Person)
if ok {
fmt.Printf("Hello %s!\n", person.firstName)
}
}