Better HN
topnewbestaskshowjobs
Log inSign up

lzap

2 karma · joined Oct 19, 2016 (10y ago) · 6 submissions

Submissions

comment 10mo ago · link · parent

I like how old-school HN comment section does not care about creepy links at all. Or link for that matter.

comment 3y ago · link · parent

I was trying to say that eventually, errors in Go distill to strings. Of course the type which represents errors can be anything, I thought it is obvious and it is also mentioned in the introduction section which you may have skipped.

comment 3y ago · link · parent

Great example, should have known this one.

comment 3y ago · link · parent

As I said in the article, the example is simplified. As you point out, incorporating the HTTP code into the error and using errors.As is much better way of doing that:

"Obviously, the common HTTP status codes could easily be a new error type (based on int type) so the actual code could be easily extracted via errors.As, but I want to keep the example simple."

comment 3y ago · link · parent

In the blogpost I specifically wrote "There is no (named) interface in the standard library..." because I was aware of the function you point out. Rather than unexported interface, I would probably call that an "anonymous interface".

Anyway, now that I read that, I should probably skip this fact and just keep the example interface. It is not uncommon practice in Go to make "copies" of interfaces to avoid extra dependency (or cyclic dependency).

6.

Xterm zen mode(lukas.zapletalovi.com ↗)

1 points · by lzap · 10y ago · discuss