Last active
August 10, 2018 12:38
-
-
Save pulkitkumar/f992ff66f8a4a21a0c43c7512ae46ce7 to your computer and use it in GitHub Desktop.
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
func fetchStruct() (*User, error) { | |
var u User | |
resp, err := http.Get("url") | |
if err != nil { | |
return &u, errors.Wrap(err, "network read error") | |
} | |
u = User{ | |
Name: "some data from resp", | |
Email: "some data from resp", | |
} | |
return &u, nil | |
} |
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
func fetchStruct() (*User, error) { | |
var u *User | |
resp, err := http.Get("url") | |
if err != nil { | |
return u, errors.Wrap(err, "network read error") | |
} | |
u = &User{ | |
Name: "some data from resp", | |
Email: "some data from resp", | |
} | |
return u, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment