Skip to content

Instantly share code, notes, and snippets.

@pulkitkumar
Created August 10, 2018 12:38
Show Gist options
  • Save pulkitkumar/c12c521c7dc27145f045bdb80a51d4e0 to your computer and use it in GitHub Desktop.
Save pulkitkumar/c12c521c7dc27145f045bdb80a51d4e0 to your computer and use it in GitHub Desktop.
Main function using a function that returns a pointer.
type User struct {
Name string
Email string
}
func main() {
var u *User
u, err := fetchStruct()
if err == nil {
modifyEmail(u)
}
}
func modifyEmail(u *User) {
u.Email = "new Email"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment