Posted on 16th September 2024|16718 views
How to convert interface to struct in Go?
Posted on 16th September 2024| views
Type person1 struct {
Username string
Lastname string
}
Func printIfperson1(object interface{}) {
person1, ok:= object. (Person1)
If ok {
fmt.printf(“Hello %s ! \n” person1.username)
}
}