diff --git a/orders.go b/orders.go index 453d7e86..95a72803 100644 --- a/orders.go +++ b/orders.go @@ -1,4 +1,3 @@ - package main const ( @@ -9,16 +8,16 @@ const ( var Orders []*Order type Order struct { - OrderID int + OrderID int Exchange string - Type int - Amount float64 - Price float64 + Type int + Amount float64 + Price float64 } -func NewOrder(Exchange string, amount, price float64) (int) { +func NewOrder(Exchange string, amount, price float64) int { order := &Order{} - if (len(Orders) == 0) { + if len(Orders) == 0 { order.OrderID = 0 } else { order.OrderID = len(Orders) @@ -31,7 +30,7 @@ func NewOrder(Exchange string, amount, price float64) (int) { return order.OrderID } -func DeleteOrder(orderID int) (bool) { +func DeleteOrder(orderID int) bool { for i := range Orders { if Orders[i].OrderID == orderID { Orders = append(Orders[:i], Orders[i+1:]...) @@ -61,4 +60,4 @@ func GetOrderByOrderID(orderID int) (*Order, bool) { } } return nil, false -} \ No newline at end of file +} diff --git a/restfulLogger.go b/restfulLogger.go index a1f21d1b..3f002e31 100644 --- a/restfulLogger.go +++ b/restfulLogger.go @@ -1,23 +1,23 @@ package main import ( - "log" - "net/http" - "time" + "log" + "net/http" + "time" ) func Logger(inner http.Handler, name string) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - start := time.Now() + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() - inner.ServeHTTP(w, r) + inner.ServeHTTP(w, r) - log.Printf( - "%s\t%s\t%s\t%s", - r.Method, - r.RequestURI, - name, - time.Since(start), - ) - }) -} \ No newline at end of file + log.Printf( + "%s\t%s\t%s\t%s", + r.Method, + r.RequestURI, + name, + time.Since(start), + ) + }) +}