Examples using... context.WithCancel()

Recent
Package sql provides a generic interface around SQL (or SQL-like) databases.
This example demonstrates the use of a cancelable context to prevent a goroutine leak. By the end of the example function, the goroutine started by gen will return without leaking.