func handleRequest(w http.ResponseWriter, r *http.Request) { // get the context from the request ctx := r.Context() // create a child context with a deadline of 2 seconds ctxWithDeadline, cancel := context.WithTimeout(ctx, 2*time.Second) defer cancel() // make sure to cancel the context when we're done // perform some operation that takes a long time result, err := longRunningOperation(ctxWithDeadline, someArgs) // handle the results, or any errors that may have occurred if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } fmt.Fprint(w, result) } func main() { http.HandleFunc("/", handleRequest) err := http.ListenAndServe(":8080", nil) if err != nil { log.Fatal(err) } }In this example, we use the `context.WithTimeout` function to create a new context that has a deadline of 2 seconds. We then pass this new context to our `longRunningOperation` function, which will automatically stop and return an error if it hasn't completed within 2 seconds. The `defer cancel()` statement makes sure that our context is always canceled when the request handler function is finished, even if it completed successfully. The `http.ListenAndServe` function from the `net/http` package is used to start the server, so the package library in this example is `net/http`. There are many other use cases for the `context` package, such as in database transactions, distributed systems, and more. Its flexibility and ease of use make it a powerful tool for managing long-running operations in Go.