Hacker News new | ask | show | jobs
by numbsafari 1036 days ago
Nice middleware package.

I have to admit, the `log.InfoContext(ctx,...` style of redundancy that permeates the standard lib at this point is really gross, especially given that the most common use case for go is going to have contexts everywhere.

2 comments

The -Context suffix is only needed when something existed before Context was created. New stuff should be just `foo.Bar(ctx, ...)`
Isn't slog, like, completely new as of this release?
Yes. Then it having separate -Context variants means they really wanted to provide both, and not just the context one.
Go’s decision to not support function overloading leads to a tonne of really ugly APIs. Obviously every decision in language design is a tradeoff, but IMO they made the wrong call here.
I'm not sure how I feel about this. What are the actual consequences of these apis being "ugly"? Like, why does that matter?
To me, at least, it is like listening to a person who constantly says "uh..." while talking. Occasionally, sure fine. But it's so pervasive in commonly used APIs that it becomes annoying.

Let's be clear: this is just a peeve of mine.