Skip to content

Commit

Permalink
Fix GoReport issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Mar 26, 2018
1 parent 966cfc7 commit c0ccc90
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 51 deletions.
10 changes: 5 additions & 5 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestSupportsPair(t *testing.T) {
_, err = cfg.SupportsPair("asdf", pair.NewCurrencyPair("BTC", "USD"))
if err == nil {
t.Error(
"Test failed. TestSupportsPair. Non-existant exchange returned nil error",
"Test failed. TestSupportsPair. Non-existent exchange returned nil error",
)
}

Expand All @@ -43,7 +43,7 @@ func TestGetAvailablePairs(t *testing.T) {
_, err = cfg.GetAvailablePairs("asdf")
if err == nil {
t.Error(
"Test failed. TestGetAvailablePairs. Non-existant exchange returned nil error",
"Test failed. TestGetAvailablePairs. Non-existent exchange returned nil error",
)
}

Expand All @@ -67,7 +67,7 @@ func TestGetEnabledPairs(t *testing.T) {
_, err = cfg.GetEnabledPairs("asdf")
if err == nil {
t.Error(
"Test failed. TestGetEnabledPairs. Non-existant exchange returned nil error",
"Test failed. TestGetEnabledPairs. Non-existent exchange returned nil error",
)
}

Expand Down Expand Up @@ -166,7 +166,7 @@ func TestGetConfigCurrencyPairFormat(t *testing.T) {
_, err = cfg.GetConfigCurrencyPairFormat("asdasdasd")
if err == nil {
t.Errorf(
"Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error",
"Test failed. TestGetRequestCurrencyPairFormat. Non-existent exchange returned nil error",
)
}

Expand All @@ -190,7 +190,7 @@ func TestGetRequestCurrencyPairFormat(t *testing.T) {
_, err = cfg.GetRequestCurrencyPairFormat("asdasdasd")
if err == nil {
t.Errorf(
"Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error",
"Test failed. TestGetRequestCurrencyPairFormat. Non-existent exchange returned nil error",
)
}

Expand Down
4 changes: 2 additions & 2 deletions currency/pair/pair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestContains(t *testing.T) {
}

if Contains(pairs, NewCurrencyPair("ETH", "USD"), false) {
t.Errorf("Test failed. TestContains: Non-existant pair was found")
t.Errorf("Test failed. TestContains: Non-existent pair was found")
}
}

Expand All @@ -273,7 +273,7 @@ func TestContainsCurrency(t *testing.T) {
}

if ContainsCurrency(p, "ETH") {
t.Error("Test failed. TestContainsCurrency: Non-existant currency was found")
t.Error("Test failed. TestContainsCurrency: Non-existent currency was found")
}
}

Expand Down
4 changes: 2 additions & 2 deletions exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestCheckExchangeExists(t *testing.T) {
}

if CheckExchangeExists("Asdsad") {
t.Errorf("Test failed. TestGetExchangeExists: Non-existant exchange found")
t.Errorf("Test failed. TestGetExchangeExists: Non-existent exchange found")
}

CleanupTest(t)
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestGetExchangeByName(t *testing.T) {

exch = GetExchangeByName("Asdasd")
if exch != nil {
t.Errorf("Test failed. TestGetExchangeByName: Non-existant exchange found")
t.Errorf("Test failed. TestGetExchangeByName: Non-existent exchange found")
}

CleanupTest(t)
Expand Down
12 changes: 6 additions & 6 deletions exchanges/alphapoint/alphapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,27 +217,27 @@ func (a *Alphapoint) SetUserInfo(firstName, lastName, cell2FACountryCode, cell2F
response := UserInfoSet{}

var userInfoKVPs = []UserInfoKVP{
UserInfoKVP{
{
Key: "FirstName",
Value: firstName,
},
UserInfoKVP{
{
Key: "LastName",
Value: lastName,
},
UserInfoKVP{
{
Key: "Cell2FACountryCode",
Value: cell2FACountryCode,
},
UserInfoKVP{
{
Key: "Cell2FAValue",
Value: cell2FAValue,
},
UserInfoKVP{
{
Key: "UseAuthy2FA",
Value: strconv.FormatBool(useAuthy2FA),
},
UserInfoKVP{
{
Key: "Use2FAForWithdraw",
Value: strconv.FormatBool(use2FAForWithdraw),
},
Expand Down
2 changes: 1 addition & 1 deletion exchanges/bitfinex/bitfinex.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStr
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}

// GetTradesV2 uses the V2 API to get historic trades that occured on the
// GetTradesV2 uses the V2 API to get historic trades that occurred on the
// exchange
//
// currencyPair e.g. "tBTCUSD" v2 prefixes currency pairs with t. (?)
Expand Down
2 changes: 1 addition & 1 deletion exchanges/bittrex/bittrex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestGetOrderHistory(t *testing.T) {
}
}

func TestGetWithdrawelHistory(t *testing.T) {
func TestGetwithdrawalHistory(t *testing.T) {
t.Parallel()
obj := Bittrex{}
obj.APIKey = apiKey
Expand Down
2 changes: 1 addition & 1 deletion exchanges/coinut/coinut_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type OrderResponse struct {
Side string `json:"side"`
}

// Commission holds trade commision structure
// Commission holds trade commission structure
type Commission struct {
Currency string `json:"currency"`
Amount float64 `json:"amount,string"`
Expand Down
2 changes: 1 addition & 1 deletion exchanges/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func TestSetCurrencies(t *testing.T) {

err = UAC.SetCurrencies([]pair.CurrencyPair{newPair}, true)
if err == nil {
t.Fatal("Test failed. TestSetCurrencies returned nil error on non-existant exchange")
t.Fatal("Test failed. TestSetCurrencies returned nil error on non-existent exchange")
}

UAC.Name = "ANX"
Expand Down
2 changes: 1 addition & 1 deletion exchanges/exmo/exmo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type PairSettings struct {
MinAmount float64 `json:"min_amount,string"`
}

// AuthResponse stores the auth reponse
// AuthResponse stores the auth response
type AuthResponse struct {
Result bool `json:"bool"`
Error string `json:"error"`
Expand Down
2 changes: 1 addition & 1 deletion exchanges/hitbtc/hitbtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (p *HitBTC) GetSymbols(symbol string) ([]string, error) {
}

// GetSymbolsDetailed is the same as above but returns an array of symbols with
// all ther details.
// all their details.
func (p *HitBTC) GetSymbolsDetailed() ([]Symbol, error) {
resp := []Symbol{}
path := fmt.Sprintf("%s/%s", apiURL, apiV2Symbol)
Expand Down
2 changes: 1 addition & 1 deletion exchanges/hitbtc/hitbtc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ type MoveOrderResponse struct {
Trades map[string][]ResultingTrades `json:"resultingTrades"`
}

// Withdraw holds response for a withdrawel process
// Withdraw holds response for a withdrawal process
type Withdraw struct {
Response string `json:"response"`
Error string `json:"error"`
Expand Down
2 changes: 1 addition & 1 deletion exchanges/huobi/huobi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type Detail struct {
Open float64 `json:"open"`
Close float64 `json:"close"`
High float64 `json:"high"`
Timestamp int64 `json:"id"`
Timestamp int64 `json:"timestamp"`
ID int `json:"id"`
Count int `json:"count"`
Low float64 `json:"low"`
Expand Down
4 changes: 2 additions & 2 deletions exchanges/localbitcoins/localbitcoins.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ func (l *LocalBitcoins) GetAccountInfo(username string, self bool) (AccountInfo,
}

// Getads returns information of single advertisement based on the ad ID, if
// adID ommited.
// adID omitted.
//
// adID - [optional] string if ommited returns all ads
// adID - [optional] string if omitted returns all ads
func (l *LocalBitcoins) Getads(adID string) (AdData, error) {
type response struct {
Data AdData `json:"data"`
Expand Down
2 changes: 1 addition & 1 deletion exchanges/okcoin/okcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ func (o *OKCoin) CancelFuturesOrder(orderID int64, symbol, contractType string)
}
}

// GetFuturesOrderInfo returns information on a specfic futures contract order
// GetFuturesOrderInfo returns information on a specific futures contract order
func (o *OKCoin) GetFuturesOrderInfo(orderID, status, currentPage, pageLength int64, symbol, contractType string) {
v := url.Values{}
v.Set("symbol", symbol)
Expand Down
44 changes: 22 additions & 22 deletions exchanges/orderbook/orderbook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestCalculateTotalBids(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Bids: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{{Price: 100, Amount: 10}},
LastUpdated: time.Now(),
}

Expand All @@ -29,7 +29,7 @@ func TestCalculateTotaAsks(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
LastUpdated: time.Now(),
}

Expand All @@ -46,13 +46,13 @@ func TestUpdate(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
LastUpdated: timeNow,
}

asks := []Item{Item{Price: 200, Amount: 101}}
bids := []Item{Item{Price: 201, Amount: 100}}
asks := []Item{{Price: 200, Amount: 101}}
bids := []Item{{Price: 201, Amount: 100}}
time.Sleep(time.Millisecond * 50)
base.Update(bids, asks)

Expand All @@ -76,8 +76,8 @@ func TestGetOrderbook(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

CreateNewOrderbook("Exchange", currency, base, Spot)
Expand Down Expand Up @@ -115,8 +115,8 @@ func TestGetOrderbookByExchange(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

CreateNewOrderbook("Exchange", currency, base, Spot)
Expand All @@ -127,9 +127,9 @@ func TestGetOrderbookByExchange(t *testing.T) {
err)
}

_, err = GetOrderbookByExchange("nonexistant")
_, err = GetOrderbookByExchange("nonexistent")
if err == nil {
t.Fatal("Test failed. TestGetOrderbookByExchange retrieved non-existant orderbook")
t.Fatal("Test failed. TestGetOrderbookByExchange retrieved non-existent orderbook")
}
}

Expand All @@ -138,8 +138,8 @@ func TestFirstCurrencyExists(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

CreateNewOrderbook("Exchange", currency, base, Spot)
Expand All @@ -159,8 +159,8 @@ func TestSecondCurrencyExists(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

CreateNewOrderbook("Exchange", currency, base, Spot)
Expand All @@ -180,8 +180,8 @@ func TestCreateNewOrderbook(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

CreateNewOrderbook("Exchange", currency, base, Spot)
Expand Down Expand Up @@ -212,8 +212,8 @@ func TestProcessOrderbook(t *testing.T) {
base := Base{
Pair: currency,
CurrencyPair: currency.Pair().String(),
Asks: []Item{Item{Price: 100, Amount: 10}},
Bids: []Item{Item{Price: 200, Amount: 10}},
Asks: []Item{{Price: 100, Amount: 10}},
Bids: []Item{{Price: 200, Amount: 10}},
}

ProcessOrderbook("Exchange", currency, base, Spot)
Expand All @@ -240,7 +240,7 @@ func TestProcessOrderbook(t *testing.T) {
t.Fatal("Test failed. TestProcessOrderbook result pair is incorrect")
}

base.Asks = []Item{Item{Price: 200, Amount: 200}}
base.Asks = []Item{{Price: 200, Amount: 200}}
ProcessOrderbook("Exchange", currency, base, "monthly")

result, err = GetOrderbook("Exchange", currency, "monthly")
Expand All @@ -253,7 +253,7 @@ func TestProcessOrderbook(t *testing.T) {
t.Fatal("Test failed. TestProcessOrderbook CalculateTotalsAsks incorrect values")
}

base.Bids = []Item{Item{Price: 420, Amount: 200}}
base.Bids = []Item{{Price: 420, Amount: 200}}
ProcessOrderbook("Blah", currency, base, "quarterly")
result, err = GetOrderbook("Blah", currency, "quarterly")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion portfolio/portfolio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestGetEthereumBalance(t *testing.T) {
}

response, err = GetEthereumBalance(nonsenseAddress)
if response.Error.Message != "" {
if response.Error.Message != "" || err == nil {
t.Errorf("Test Failed - Portfolio GetEthereumBalance() Error: %s",
response.Error.Message)
}
Expand Down
3 changes: 1 addition & 2 deletions tools/documentation/documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func main() {
GoCryptoTrader: Exchange documentation tool
This will update and regenerate documentation for the different packages
in GoCryptoTrader.
`)
in GoCryptoTrader.`)

codebasePaths = make(map[string]string)
codebaseTemplatePath = make(map[string]string)
Expand Down

0 comments on commit c0ccc90

Please sign in to comment.