2 ms·
>No constructors You can create a function which makes (and populates) the struct. For example, https://play.golang.com/p/rvSvEZNkXe https://play.golang.com/p
by greenhouse_gas 9y ago
>No constructors
You can create a function which makes (and populates) the struct.
For example, https://play.golang.com/p/rvSvEZNkXe https://play.golang.com/p/rvSvEZNkXe
>Error handling is ugly and tedious. Not being able to get the type of an error makes it a lot more inconvenient.
See https://stackoverflow.com/a/7006853/5849285 https://stackoverflow.com/a/7006853/5849285 to switch on type (error is a interface with a Error func[1]), so you can define different error types [2], or use `int` to define error type.
[1]: https://blog.golang.org/error-handling-and-go https://blog.golang.org/error-handling-and-go
[2]: For example, os.Open returns a * PathError