mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd-tester: fix govet
This commit is contained in:
parent
35d2d7b23e
commit
cb280bae91
@ -26,8 +26,19 @@ type statusHandler struct {
|
||||
func (sh statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
en := json.NewEncoder(w)
|
||||
err := en.Encode(sh.status.get())
|
||||
if err != nil {
|
||||
|
||||
sh.status.mu.Lock()
|
||||
defer sh.status.mu.Unlock()
|
||||
|
||||
if err := en.Encode(Status{
|
||||
Since: sh.status.Since,
|
||||
Failures: sh.status.Failures,
|
||||
RoundLimit: sh.status.RoundLimit,
|
||||
Cluster: sh.status.cluster.Status(),
|
||||
cluster: sh.status.cluster,
|
||||
Round: sh.status.Round,
|
||||
Case: sh.status.Case,
|
||||
}); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
@ -208,16 +208,6 @@ type Status struct {
|
||||
Case int
|
||||
}
|
||||
|
||||
// get gets a copy of status
|
||||
func (s *Status) get() Status {
|
||||
s.mu.Lock()
|
||||
got := *s
|
||||
cluster := s.cluster
|
||||
s.mu.Unlock()
|
||||
got.Cluster = cluster.Status()
|
||||
return got
|
||||
}
|
||||
|
||||
func (s *Status) setRound(r int) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user