|
|
|
|
|
by ben_jones
3134 days ago
|
|
What? // example for unmarshalling an http request to JSON contents, err := ioutil.Readall(req.Body) if err != nil {
return err
} req.Body.Close() user := new(User) if err := json.Unmarshal(contents, user); err != nil {
return nil
} // do whatever you want with 'user' |
|
Does Go have something analogous to Rust's `try!` or `?` operator, which would turn it into (pseudocode):
Or: If not, why not?(I don't know Go)