Created
August 10, 2018 12:38
-
-
Save pulkitkumar/c12c521c7dc27145f045bdb80a51d4e0 to your computer and use it in GitHub Desktop.
Main function using a function that returns a pointer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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