Addressed various points raised in review: error-handling, simplified Fprint call

This commit is contained in:
Bryan Boreham committed 2014-09-04 14:44:42 +01:00
1 parent 67d8220bdf
commit 04ca3d2469
2 files changed
+12 -5

No files matched your search

+6 -2
View File
@@ -6,6 +6,7 @@ import (
"crypto/sha256"
"flag"
"fmt"
"io"
"github.com/davecheney/profile"
"log"
"net"
@@ -136,10 +137,13 @@ func main() {
func handleHttp(router *weave.Router) {
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, router.Status())
io.WriteString(w, router.Status())
})
address := fmt.Sprintf(":%d", weave.StatusPort)
http.ListenAndServe(address, nil)
err := http.ListenAndServe(address, nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}