1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Correct fmt.Fprintf and t.Fatalf

Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
This commit is contained in:
fate-grand-order 2017-02-08 11:22:21 +08:00
parent 41650df87e
commit 921002137a
2 changed files with 4 additions and 4 deletions

View file

@ -29,13 +29,13 @@ func profilerSetup(mainRouter *mux.Router) {
func expVars(w http.ResponseWriter, r *http.Request) {
first := true
w.Header().Set("Content-Type", "application/json; charset=utf-8")
fmt.Fprintf(w, "{\n")
fmt.Fprintln(w, "{")
expvar.Do(func(kv expvar.KeyValue) {
if !first {
fmt.Fprintf(w, ",\n")
fmt.Fprintln(w, ",")
}
first = false
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
})
fmt.Fprintf(w, "\n}\n")
fmt.Fprintln(w, "\n}")
}

View file

@ -29,7 +29,7 @@ func TestMiddlewares(t *testing.T) {
localHandler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if httputils.VersionFromContext(ctx) == "" {
t.Fatalf("Expected version, got empty string")
t.Fatal("Expected version, got empty string")
}
if sv := w.Header().Get("Server"); !strings.Contains(sv, "Docker/0.1omega2") {