Skip to content

Commit

Permalink
Merge pull request #537 from bboreham/master
Browse files Browse the repository at this point in the history
Simplify printing
  • Loading branch information
rade committed Apr 10, 2015
2 parents c13980a + d32f328 commit 0540e41
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions nameserver/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/gorilla/mux"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"io"
"log"
"net"
"net/http"
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions weavedns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

Expand Down
7 changes: 3 additions & 4 deletions weaver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0540e41

Please sign in to comment.