Skip to content

Commit

Permalink
gofmt -s failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbhamra1 committed Jun 7, 2023
1 parent 42d4df1 commit 32950b9
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions dgraph/cmd/zero/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ func (s *Server) zeroHealth(ctx context.Context) (*api.Response, error) {
return nil, ctx.Err()
}
health := pb.HealthInfo{
Instance: "zero",
Address: x.WorkerConfig.MyAddr,
Status: "healthy",
Version: x.Version(),
Uptime: int64(time.Since(x.WorkerConfig.StartTime) / time.Second),
LastEcho: time.Now().Unix(),
Instance: "zero",
Address: x.WorkerConfig.MyAddr,
Status: "healthy",
Version: x.Version(),
Uptime: int64(time.Since(x.WorkerConfig.StartTime) / time.Second),
LastEcho: time.Now().Unix(),
}
jsonOut, err := json.Marshal(health)
if err != nil {
Expand All @@ -256,24 +256,24 @@ func (s *Server) zeroHealth(ctx context.Context) (*api.Response, error) {
func (st *state) pingResponse(w http.ResponseWriter, r *http.Request) {
x.AddCorsHeaders(w)
switch r.Header.Get("Accept") {
case "application/json":
resp, err := (st.zero).zeroHealth(r.Context())
if err != nil {
x.SetStatus(w, x.Error, err.Error())
return
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusOK)
if _, err := w.Write(resp.Json); err != nil {
glog.Warningf("could not send error msg=[%v] code=[%+v] due to http error %+v", err.Error(), x.Error, err)
return
}
default:
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusOK)
if _, err := w.Write([]byte("OK")); err != nil {
glog.Warningf("Could not send error msg=[%v] code=[%+v] due to http error %+v", err.Error(), x.Error, err)
return
}
case "application/json":
resp, err := (st.zero).zeroHealth(r.Context())
if err != nil {
x.SetStatus(w, x.Error, err.Error())
return
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusOK)
if _, err := w.Write(resp.Json); err != nil {
glog.Warningf("could not send error msg=[%v] code=[%+v] due to http error %+v", err.Error(), x.Error, err)
return
}
default:
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusOK)
if _, err := w.Write([]byte("OK")); err != nil {
glog.Warningf("Could not send error msg=[%v] code=[%+v] due to http error %+v", err.Error(), x.Error, err)
return
}
}
}

0 comments on commit 32950b9

Please sign in to comment.