github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/simple/hello-web.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "fmt" 7 "log" 8 "net/http" 9 ) 10 11 type Greeting string 12 13 func (g Greeting) ServeHTTP(w http.ResponseWriter, r *http.Request) { 14 fmt.Fprint(w, g) 15 } 16 17 func main() { 18 err := http.ListenAndServe("localhost:4000", Greeting("Hello, go")) 19 if err != nil { 20 log.Fatal(err) 21 } 22 }