mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
Fixes go fmt
This commit is contained in:
17
orders.go
17
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
})
|
||||
}
|
||||
log.Printf(
|
||||
"%s\t%s\t%s\t%s",
|
||||
r.Method,
|
||||
r.RequestURI,
|
||||
name,
|
||||
time.Since(start),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user