etcdserver: address golangci var-naming issues

Signed-off-by: Ivan Valdes <ivan@vald.es>
This commit is contained in:
Ivan Valdes
2024-03-18 14:04:10 -07:00
parent 63e394d090
commit c613b78e6c
21 changed files with 124 additions and 113 deletions

View File

@@ -139,7 +139,7 @@ func (e Error) Error() string {
return e.Message + " (" + e.Cause + ")"
}
func (e Error) toJsonString() string {
func (e Error) toJSONString() string {
b, _ := json.Marshal(e)
return string(b)
}
@@ -156,6 +156,6 @@ func (e Error) WriteTo(w http.ResponseWriter) error {
w.Header().Add("X-Etcd-Index", fmt.Sprint(e.Index))
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(e.StatusCode())
_, err := w.Write([]byte(e.toJsonString() + "\n"))
_, err := w.Write([]byte(e.toJSONString() + "\n"))
return err
}

View File

@@ -33,8 +33,8 @@ func TestErrorWriteTo(t *testing.T) {
}
gbody := strings.TrimSuffix(rr.Body.String(), "\n")
if err.toJsonString() != gbody {
t.Errorf("HTTP body %q, want %q", gbody, err.toJsonString())
if err.toJSONString() != gbody {
t.Errorf("HTTP body %q, want %q", gbody, err.toJSONString())
}
wheader := http.Header(map[string][]string{