Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strconv"
- )
- type Foo struct {
- A int
- }
- func main() {
- var f *Foo
- var err error
- if f, err = Bar("1"); err != nil {
- //Actual error handling
- }
- fmt.Println(f.A)
- }
- func Bar(input string) (f *Foo, err error) {
- f = new(Foo)
- f.A, err = strconv.Atoi(input)
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement