Hacker News new | ask | show | jobs
by stevekemp 47 days ago
In go there are the "init" functions, but those do not return a possible error result.

I guess you're thinking more of package constructor methods, such as NewFoo, which tend to return the new object and an error value.

1 comments

yes, I use init sparingly and generally panic, for low level program startup, versus the NewFoo functions, which are for dynamic objects the way constructors are used, I use NewFoo -> (Foo, error) for internal runtime, client, and configuration handling as well