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

> Correct me if I'm wrong, but I don't believe Go's type system enforces you check and handle errors either

Go's type system doesn't, but the compiler will in a good number of cases. For example, this will produce a compile time error:

    value, err := Foo()
    fmt.Println(value)
It produces an error because `err` was declared and unused.

The following defeats this check though:

    value, _ := Foo()
    // Bar returns one value: an error
    _ = Bar()
    Bar()
The above list probably isn't exhaustive.


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

Search: