mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 15:10:59 +00:00
linter: Enable gofumpt and run against codebase (#1848)
* linter: Enable gofumpt and run against codebase * Address shazbert's nits * gofumpt: Fix issues after rebase
This commit is contained in:
@@ -595,7 +595,8 @@ func fillData(exchName, checkType string, data interface{}) (ExchangeInfo, error
|
||||
TokenData: tempData.TokenData,
|
||||
TokenDataEnd: tempData.TokenDataEnd,
|
||||
Val: tempData.Val,
|
||||
Path: tempData.Path},
|
||||
Path: tempData.Path,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
default:
|
||||
@@ -1235,7 +1236,8 @@ func sendGetReq(path string, result interface{}) error {
|
||||
Method: http.MethodGet,
|
||||
Path: path,
|
||||
Result: result,
|
||||
Verbose: verbose}
|
||||
Verbose: verbose,
|
||||
}
|
||||
return requester.SendPayload(context.Background(), request.Unset, func() (*request.Item, error) {
|
||||
return item, nil
|
||||
}, request.UnauthenticatedRequest)
|
||||
@@ -1253,7 +1255,8 @@ func sendAuthReq(method, path string, result interface{}) error {
|
||||
Method: method,
|
||||
Path: path,
|
||||
Result: result,
|
||||
Verbose: verbose}
|
||||
Verbose: verbose,
|
||||
}
|
||||
return requester.SendPayload(context.Background(), request.Unset, func() (*request.Item, error) {
|
||||
return item, nil
|
||||
}, request.AuthenticatedRequest)
|
||||
|
||||
@@ -131,14 +131,16 @@ func TestCheckExistingExchanges(t *testing.T) {
|
||||
|
||||
func TestCheckChangeLog(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "revision-history",
|
||||
TokenDataEnd: "table",
|
||||
TextTokenData: "td",
|
||||
DateFormat: "2006/01/02",
|
||||
RegExp: `^20(\d){2}/(\d){2}/(\d){2}$`,
|
||||
Path: "https://docs.gemini.com/rest-api/#revision-history"}
|
||||
Path: "https://docs.gemini.com/rest-api/#revision-history",
|
||||
}
|
||||
if _, err := checkChangeLog(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -162,7 +164,8 @@ func TestAdd(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeGemini(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "revision-history",
|
||||
TokenDataEnd: "table",
|
||||
@@ -170,7 +173,8 @@ func TestHTMLScrapeGemini(t *testing.T) {
|
||||
DateFormat: "2006/01/02",
|
||||
RegExp: "^20(\\d){2}/(\\d){2}/(\\d){2}$",
|
||||
CheckString: "2019/11/15",
|
||||
Path: "https://docs.gemini.com/rest-api/#revision-history"}
|
||||
Path: "https://docs.gemini.com/rest-api/#revision-history",
|
||||
}
|
||||
_, err := htmlScrapeDefault(&data)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -179,7 +183,8 @@ func TestHTMLScrapeGemini(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeHuobi(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "change-log",
|
||||
TokenDataEnd: "h2",
|
||||
@@ -187,7 +192,8 @@ func TestHTMLScrapeHuobi(t *testing.T) {
|
||||
DateFormat: "2006.01.02 15:04",
|
||||
RegExp: "^20(\\d){2}.(\\d){2}.(\\d){2} (\\d){2}:(\\d){2}$",
|
||||
CheckString: "2019.12.27 19:00",
|
||||
Path: "https://huobiapi.github.io/docs/spot/v1/en/#change-log"}
|
||||
Path: "https://huobiapi.github.io/docs/spot/v1/en/#change-log",
|
||||
}
|
||||
_, err := htmlScrapeDefault(&data)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -196,7 +202,8 @@ func TestHTMLScrapeHuobi(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeCoinbasepro(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "changelog",
|
||||
TokenDataEnd: "ul",
|
||||
@@ -204,7 +211,8 @@ func TestHTMLScrapeCoinbasepro(t *testing.T) {
|
||||
DateFormat: "01/02/06",
|
||||
RegExp: "^(\\d){1,2}/(\\d){1,2}/(\\d){2}$",
|
||||
CheckString: "12/16/19",
|
||||
Path: "https://docs.pro.coinbase.com/#changelog"}
|
||||
Path: "https://docs.pro.coinbase.com/#changelog",
|
||||
}
|
||||
_, err := htmlScrapeDefault(&data)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -213,9 +221,11 @@ func TestHTMLScrapeCoinbasepro(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeBitfinex(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{DateFormat: "2006-01-02",
|
||||
RegExp: `section-v-(2\d{3}-\d{1,2}-\d{1,2})`,
|
||||
Path: "https://docs.bitfinex.com/docs/changelog"}
|
||||
data := HTMLScrapingData{
|
||||
DateFormat: "2006-01-02",
|
||||
RegExp: `section-v-(2\d{3}-\d{1,2}-\d{1,2})`,
|
||||
Path: "https://docs.bitfinex.com/docs/changelog",
|
||||
}
|
||||
_, err := htmlScrapeBitfinex(&data)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -224,14 +234,16 @@ func TestHTMLScrapeBitfinex(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeBitmex(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h4",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h4",
|
||||
Key: "id",
|
||||
Val: "",
|
||||
TokenDataEnd: "",
|
||||
TextTokenData: "",
|
||||
DateFormat: "Jan-2-2006",
|
||||
RegExp: `([A-Z]{1}[a-z]{2}-\d{1,2}-2\d{3})`,
|
||||
Path: "https://www.bitmex.com/static/md/en-US/apiChangelog"}
|
||||
Path: "https://www.bitmex.com/static/md/en-US/apiChangelog",
|
||||
}
|
||||
if _, err := htmlScrapeBitmex(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -239,8 +251,10 @@ func TestHTMLScrapeBitmex(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeHitBTC(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `newest version \d{1}.\d{1}`,
|
||||
Path: "https://api.hitbtc.com/"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `newest version \d{1}.\d{1}`,
|
||||
Path: "https://api.hitbtc.com/",
|
||||
}
|
||||
if _, err := htmlScrapeHitBTC(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -248,8 +262,10 @@ func TestHTMLScrapeHitBTC(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeBTSE(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `^version: \d{1}.\d{1}.\d{1}`,
|
||||
Path: "https://api.btcmarkets.net/openapi/info/index.yaml"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `^version: \d{1}.\d{1}.\d{1}`,
|
||||
Path: "https://api.btcmarkets.net/openapi/info/index.yaml",
|
||||
}
|
||||
if _, err := htmlScrapeBTSE(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -257,8 +273,10 @@ func TestHTMLScrapeBTSE(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeBTCMarkets(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `^version: \d{1}.\d{1}.\d{1}`,
|
||||
Path: "https://api.btcmarkets.net/openapi/info/index.yaml"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `^version: \d{1}.\d{1}.\d{1}`,
|
||||
Path: "https://api.btcmarkets.net/openapi/info/index.yaml",
|
||||
}
|
||||
if _, err := htmlScrapeBTCMarkets(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -266,11 +284,13 @@ func TestHTMLScrapeBTCMarkets(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeBitflyer(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "p",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "p",
|
||||
TokenDataEnd: "h3",
|
||||
TextTokenData: "code",
|
||||
RegExp: `^https://api.bitflyer.com/v\d{1}/$`,
|
||||
Path: "https://lightning.bitflyer.com/docs?lang=en"}
|
||||
Path: "https://lightning.bitflyer.com/docs?lang=en",
|
||||
}
|
||||
if _, err := htmlScrapeBitflyer(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -278,8 +298,10 @@ func TestHTMLScrapeBitflyer(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeANX(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `ANX Exchange API v\d{1}`,
|
||||
Path: "https://anxv3.docs.apiary.io/#reference/quickstart-catalog"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `ANX Exchange API v\d{1}`,
|
||||
Path: "https://anxv3.docs.apiary.io/#reference/quickstart-catalog",
|
||||
}
|
||||
if _, err := htmlScrapeANX(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -287,14 +309,16 @@ func TestHTMLScrapeANX(t *testing.T) {
|
||||
|
||||
func TestHTMLPoloniex(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "changelog",
|
||||
TokenDataEnd: "div",
|
||||
TextTokenData: "h2",
|
||||
DateFormat: "2006-01-02",
|
||||
RegExp: `(2\d{3}-\d{1,2}-\d{1,2})`,
|
||||
Path: "https://docs.poloniex.com/#changelog"}
|
||||
Path: "https://docs.poloniex.com/#changelog",
|
||||
}
|
||||
if _, err := htmlScrapePoloniex(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -302,8 +326,10 @@ func TestHTMLPoloniex(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeExmo(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `Last updated on [\s\S]*, 20\d{2}`,
|
||||
Path: "https://exmo.com/en/api/"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `Last updated on [\s\S]*, 20\d{2}`,
|
||||
Path: "https://exmo.com/en/api/",
|
||||
}
|
||||
if _, err := htmlScrapeExmo(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -311,8 +337,10 @@ func TestHTMLScrapeExmo(t *testing.T) {
|
||||
|
||||
func TestHTMLBitstamp(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `refer to the v\d{1} API for future references.`,
|
||||
Path: "https://www.bitstamp.net/api/"}
|
||||
data := HTMLScrapingData{
|
||||
RegExp: `refer to the v\d{1} API for future references.`,
|
||||
Path: "https://www.bitstamp.net/api/",
|
||||
}
|
||||
if _, err := htmlScrapeBitstamp(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -320,11 +348,13 @@ func TestHTMLBitstamp(t *testing.T) {
|
||||
|
||||
func TestHTMLKraken(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h3",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h3",
|
||||
TokenDataEnd: "p",
|
||||
TextTokenData: "p",
|
||||
RegExp: `URL: https://api.kraken.com/\d{1}/private/Balance`,
|
||||
Path: "https://www.kraken.com/features/api"}
|
||||
Path: "https://www.kraken.com/features/api",
|
||||
}
|
||||
if _, err := htmlScrapeKraken(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -332,13 +362,15 @@ func TestHTMLKraken(t *testing.T) {
|
||||
|
||||
func TestHTMLAlphaPoint(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h1",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h1",
|
||||
Key: "id",
|
||||
Val: "introduction",
|
||||
TokenDataEnd: "blockquote",
|
||||
TextTokenData: "h3",
|
||||
RegExp: `revised-calls-\d{1}-\d{1}-\d{1}-gt-\d{1}-\d{1}-\d{1}`,
|
||||
Path: "https://alphapoint.github.io/slate/#introduction"}
|
||||
Path: "https://alphapoint.github.io/slate/#introduction",
|
||||
}
|
||||
if _, err := htmlScrapeAlphaPoint(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -346,9 +378,11 @@ func TestHTMLAlphaPoint(t *testing.T) {
|
||||
|
||||
func TestHTMLYobit(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "h2",
|
||||
Key: "id",
|
||||
Path: "https://www.yobit.net/en/api/"}
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "h2",
|
||||
Key: "id",
|
||||
Path: "https://www.yobit.net/en/api/",
|
||||
}
|
||||
if _, err := htmlScrapeYobit(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -356,12 +390,14 @@ func TestHTMLYobit(t *testing.T) {
|
||||
|
||||
func TestHTMLScrapeOk(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "a",
|
||||
data := HTMLScrapingData{
|
||||
TokenData: "a",
|
||||
Key: "href",
|
||||
Val: "./#change-change",
|
||||
TokenDataEnd: "./#change-",
|
||||
RegExp: `./#change-\d{8}`,
|
||||
Path: "https://www.okx.com/docs/en/"}
|
||||
Path: "https://www.okx.com/docs/en/",
|
||||
}
|
||||
if _, err := htmlScrapeOk(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -375,10 +411,14 @@ func TestUpdate(t *testing.T) {
|
||||
exchCheck = *configData.Exchanges[x].Data.HTMLData
|
||||
}
|
||||
}
|
||||
info := ExchangeInfo{Name: "Exmo",
|
||||
info := ExchangeInfo{
|
||||
Name: "Exmo",
|
||||
CheckType: "HTML String Check",
|
||||
Data: &CheckData{HTMLData: &HTMLScrapingData{RegExp: `Last updated on [\s\S]*, 20\d{2}`,
|
||||
Path: "https://exmo.com/en/api/"},
|
||||
Data: &CheckData{
|
||||
HTMLData: &HTMLScrapingData{
|
||||
RegExp: `Last updated on [\s\S]*, 20\d{2}`,
|
||||
Path: "https://exmo.com/en/api/",
|
||||
},
|
||||
},
|
||||
}
|
||||
updatedExchs := update("Exmo", configData.Exchanges, info)
|
||||
|
||||
Reference in New Issue
Block a user