Hacker News new | past | comments | ask | show | jobs | submit login

Make a decision to or forget to check error codes.

My gripe is fairly different from the OP's in this aspect. Go is inconsistent. For functions that return values I need to use, I will be warned by the compiler if I forget to handle the error. For those that don't, the compiler will happily let me accidentally ignore the error.

I'd rather require that all return values be handled whether I use them or not. For the rare case that a function returns a value I honestly don't care about, I can just use _. At least I'm not hiding the fact that I knowingly am ignoring stuff.

(Edit: despite the above, I still do enjoy using Go.)




I can understand why that inconsistency is frustrating. Similarly:

    typedObj, err = something.(type)
    typedObj = something.(type)
    obj = someMap[key]
    obj, ok = someMap[key]


It's

    typedObj, ok = something.(type)
just like it is with maps, or any other ", ok" thing.

http://play.golang.org/p/I-5kD88knC


Oi vey, mea culpa.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: