Source file src/cmd/link/internal/ld/testdata/httptest/main/main.go
1 // A small test program that uses the net/http package. There is 2 // nothing special about net/http here, this is just a convenient way 3 // to pull in a lot of code. 4 5 package main 6 7 import ( 8 "net/http" 9 "net/http/httptest" 10 ) 11 12 type statusHandler int 13 14 func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 15 w.WriteHeader(int(*h)) 16 } 17 18 func main() { 19 status := statusHandler(http.StatusNotFound) 20 s := httptest.NewServer(&status) 21 defer s.Close() 22 } 23