Addressed various points raised in review: error-handling, simplified Fprint call
This commit is contained in:
1 parent
67d8220bdf
commit
04ca3d2469
2 files changed
+12
-5
No files matched your search
+6
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user