package main import "fmt" type User struct{ ID int name string } func (user *User) getName() string { return user.name } func main() { user1 := User{1,"abc"} user2 := &user1 user2.name="kk" fmt.Println(user1.getName(),user2.getName()) }