Skip to content

Instantly share code, notes, and snippets.

@squirly
squirly / using-context.go
Created July 11, 2016 23:32
Golang net/http Context and Dependency Injection
package main
import (
"context"
"net/http"
)
func main() {
helloHandler := AddMessageMiddleware("Hello!", http.HandlerFunc(RespondWithMessage))
goodbyeHandler := AddMessageMiddleware("Goodbye!", http.HandlerFunc(RespondWithMessage))