Simplify printing

This commit is contained in:
Bryan Boreham committed 2015-04-10 14:46:31 +01:00
1 parent c13980af4b
commit d32f328c24
3 files changed
+6 -9

No files matched your search

+2 -3
View File
@@ -5,7 +5,6 @@ import (
"github.com/gorilla/mux"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"io"
"log"
"net"
"net/http"
@@ -22,8 +21,8 @@ func ListenHTTP(version string, server *DNSServer, domain string, db Zone, port
muxRouter := mux.NewRouter()
muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, fmt.Sprintln("weave DNS", version))
io.WriteString(w, server.Status())
fmt.Fprintln(w, "weave DNS", version)
fmt.Fprintln(w, server.Status())
})
muxRouter.Methods("PUT").Path("/name/{id:.+}/{ip:.+}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+1 -2
View File
@@ -7,7 +7,6 @@ import (
"github.com/weaveworks/weave/common/updater"
weavedns "github.com/weaveworks/weave/nameserver"
weavenet "github.com/weaveworks/weave/net"
"io"
"net"
"os"
"os/signal"
@@ -49,7 +48,7 @@ func main() {
flag.Parse()
if justVersion {
io.WriteString(os.Stdout, fmt.Sprintf("weave DNS %s\n", version))
fmt.Printf("weave DNS %s\n", version)
os.Exit(0)
}
+3 -4
View File
@@ -9,7 +9,6 @@ import (
"github.com/gorilla/mux"
weavenet "github.com/weaveworks/weave/net"
weave "github.com/weaveworks/weave/router"
"io"
"log"
"net"
"net/http"
@@ -168,9 +167,9 @@ func handleHTTP(router *weave.Router, httpAddr string) {
muxRouter := mux.NewRouter()
muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, fmt.Sprintln("weave router", version))
io.WriteString(w, fmt.Sprintln("Encryption", encryption))
io.WriteString(w, router.Status())
fmt.Fprintln(w, "weave router", version)
fmt.Fprintln(w, "Encryption", encryption)
fmt.Fprintln(w, router.Status())
})
muxRouter.Methods("GET").Path("/status-json").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {