Don't use pointers when you need them not!

This commit is contained in:
Alessio Treglia
2018-08-31 19:04:45 +02:00
parent 1370ca611b
commit 122ed3a900
8 changed files with 112 additions and 112 deletions
+7 -7
View File
@@ -12,16 +12,16 @@ const (
// WriteErrorResponse prepares and writes a HTTP error
// given a status code and an error message.
func WriteErrorResponse(w *http.ResponseWriter, status int, msg string) {
(*w).WriteHeader(status)
(*w).Write([]byte(msg))
func WriteErrorResponse(w http.ResponseWriter, status int, msg string) {
w.WriteHeader(status)
w.Write([]byte(msg))
}
// WriteGasEstimateResponse prepares and writes an HTTP
// response for transactions simulations.
func WriteSimulationResponse(w *http.ResponseWriter, gas int64) {
(*w).WriteHeader(http.StatusOK)
(*w).Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
func WriteSimulationResponse(w http.ResponseWriter, gas int64) {
w.WriteHeader(http.StatusOK)
w.Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
}
// HasDryRunArg returns true if the request's URL query contains
@@ -32,7 +32,7 @@ func HasDryRunArg(r *http.Request) bool {
// ParseFloat64OrReturnBadRequest converts s to a float64 value. It returns a default
// value if the string is empty. Write
func ParseFloat64OrReturnBadRequest(w *http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {
func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {
if len(s) == 0 {
return defaultIfEmpty, true
}