Remove builds conditional on go1.7 since that is now guaranteed #2154

Old fallback code was deleted and the go1.7 style code inlined where
appropriate.
This commit is contained in:
Nick Craig-Wood 2018-04-06 20:33:51 +01:00
parent e5be471ce0
commit be54fd8f70
35 changed files with 45 additions and 157 deletions

View file

@ -9,6 +9,7 @@ package rc
import (
"encoding/json"
"io"
"net/http"
"strings"
@ -66,6 +67,13 @@ func (s *server) serve() {
s.srv.Wait()
}
// WriteJSON writes JSON in out to w
func WriteJSON(w io.Writer, out Params) error {
enc := json.NewEncoder(w)
enc.SetIndent("", "\t")
return enc.Encode(out)
}
// handler reads incoming requests and dispatches them
func (s *server) handler(w http.ResponseWriter, r *http.Request) {
path := strings.Trim(r.URL.Path, "/")