← Back to context

Comment by physicles

5 days ago

Agreed on all points.

The only place I’ve encountered this pattern is in chromedp, the go wrapper for the chrome headless browser driver. Its API… isn’t good.

Most methods you use are package globals that take a context.Context as a first parameter. But you have to understand that this context is a _special_ one: you can’t pass any old context like context.Background(), you must pass a context you got from one of the factory methods.

If you want to specify a timeout, you use context.WithTimeout. Clever I guess, but that’s the only setting that works like that.

It’s essentially a void*.