// User
type User struct {
ID int
FirstName string
}
// Method
func (u *User) describe() string {
desc := fmt.Sprintf("Name %s", u.FirstName)
return desc
}
// Order:
// 0 1 2 defer panic: NOT 2
func main() {
user := User{FirstName: "JK", ID: 1}
fmt.Println(user.describe())
}
describe() is a prop method on User struct
标签:string,FirstName,describe,User,Go,Method,struct From: https://www.cnblogs.com/Answer1215/p/16660304.html