Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, the biggest wart is error handling.

    foo, err := getFoo()
    if err != nil ...

    bar, err := getBar()
    fmt.Println(bar)
Misses an error check on getBar. Scoping rules mean that

    if foo, err := getFoo(); err != nil
Gets untenable with nesting fairly quickly.

It also introduces invalid states - what does getFoo return if it returns an error too. Do we change the API to return a pointer and return nil, or do we have a partially constructed object that is in an invalid state?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: