So I'm having some trouble w/ a silly deadlock in Go code (as one does). In addition to fixing the proximate bug, I also took this opportunity to figure out why the fallback mechanism, context.WithTimeout, wasn't kicking in like it should have.
Part of the reason was that I wasn't passing the context deep enough, so blocking sends like
func (s *Server) Foo(f FooData) {
s.foo <- f
}
should have looked like
func (s *Server) Foo(ctx context.Context, f FooData) {
select {
case s.foo <- f:
case <-ctx.Done():
}
}
sure ok fine whatever. "ctx as first parameter means it should be treated like it's async-colored" i can get behind this. i'm already writing 300 lines of boilerplate for everything what's a couple more.
but then. did you know that Mr. Rob "golang" Pike's dear old sync standard library containing implementations of classic data structures like Mutex and Cond(ition variable), don't work with context. because lol lmao clownshoes language point & laugh everyone
not so funny when i'm the one getting hit in the face with pie though... I was fortunate enough for this to be testing code that I can work around with various Hacks but great scott geez o pete i do not like this
