We rolled our own type that implemented context.Context in order to get the ability to distinguish between sources of context cancellation, which is necessary for the behavior of the hot reloader, to tell between a file change event, which triggers the reload, and a CTRL-C or SIGTERM, which should shut down the server.
With Go 1.20's addition of WithCancelCause() and Cause() in the context package, along with errors.Is(), it's much simpler to determine the source of a cancellation.
This simplifies Pushup's implementation, and it's always good to use some stdlib code instead of your own jank when it makes sense.
This does change Pushup's minimum dependency on Go to version 1.20, but this only applies if you are developing Pushup itself - if you are just making Pushup apps, you don't need to upgrade to 1.20.
We rolled our own type that implemented context.Context in order to get the ability to distinguish between sources of context cancellation, which is necessary for the behavior of the hot reloader, to tell between a file change event, which triggers the reload, and a CTRL-C or SIGTERM, which should shut down the server.
With Go 1.20's addition of WithCancelCause() and Cause() in the
context
package, along witherrors.Is()
, it's much simpler to determine the source of a cancellation.This simplifies Pushup's implementation, and it's always good to use some stdlib code instead of your own jank when it makes sense.
This does change Pushup's minimum dependency on Go to version 1.20, but this only applies if you are developing Pushup itself - if you are just making Pushup apps, you don't need to upgrade to 1.20.