linter: Enable error checking linter (#766)

* golangci: Enable err checking linter to expose unchecked errors.

* gct: handle errors across the board

* gct: handle errors NOTE: Found bug in FTX (WIP)

* linter: fix issues

* ftx/exchanges: fix bug where error was being returned when setting pair management variables to an already enabled state

* bitmex: fix bug where a dangly supported asset in config danglied up the place.

* linter: fix more linter issues

* linter: fix my terrible spelling.

* currency: fix test

* exchanges: fix tests

* logger: fix test

* exchanges: fix tests

* glorious: nits

* vm: revert rm variable and instigate test
This commit is contained in:
Ryan O'Hara-Reid
2021-08-30 14:06:40 +10:00
committed by GitHub
parent c9ab0b1164
commit 8020e1ec6a
99 changed files with 814 additions and 293 deletions

View File

@@ -1137,7 +1137,10 @@ func htmlScrapeLocalBitcoins(htmlData *HTMLScrapingData) ([]string, error) {
return nil, err
}
str := r.FindString(string(a))
sha := crypto.GetSHA256([]byte(str))
sha, err := crypto.GetSHA256([]byte(str))
if err != nil {
return nil, err
}
var resp []string
resp = append(resp, crypto.HexEncodeToString(sha))
return resp, nil

View File

@@ -2953,8 +2953,7 @@ var withdrawalRequestCommand = &cli.Command{
func withdrawlRequestByID(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
var ID string
@@ -2990,8 +2989,7 @@ func withdrawlRequestByID(c *cli.Context) error {
func withdrawlRequestByExchangeID(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
var exchange, currency string
@@ -3058,8 +3056,7 @@ func withdrawlRequestByExchangeID(c *cli.Context) error {
func withdrawlRequestByDate(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
var exchange string
@@ -3842,8 +3839,7 @@ var gctScriptCommand = &cli.Command{
func gctScriptAutoload(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
var command, script string
@@ -3866,8 +3862,7 @@ func gctScriptAutoload(c *cli.Context) error {
case "remove":
status = true
default:
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
conn, err := setupClient()
@@ -3893,8 +3888,7 @@ func gctScriptAutoload(c *cli.Context) error {
func gctScriptExecute(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
if !c.IsSet("filename") {
@@ -3973,8 +3967,7 @@ func gctScriptList(c *cli.Context) error {
func gctScriptStop(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
if !c.IsSet("uuid") {
@@ -4024,8 +4017,7 @@ func gctScriptStopAll(c *cli.Context) error {
func gctScriptRead(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
if !c.IsSet("name") {
@@ -4058,8 +4050,7 @@ func gctScriptRead(c *cli.Context) error {
func gctScriptQuery(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
if !c.IsSet("uuid") {
@@ -4093,8 +4084,7 @@ func gctScriptQuery(c *cli.Context) error {
func gctScriptUpload(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
_ = cli.ShowSubcommandHelp(c)
return nil
return cli.ShowSubcommandHelp(c)
}
var overwrite bool

View File

@@ -89,7 +89,12 @@ func main() {
Subtotal float64
}
cfg.RetrieveConfigCurrencyPairs(true, asset.Spot)
err = cfg.RetrieveConfigCurrencyPairs(true, asset.Spot)
if err != nil {
log.Printf("Failed to retrieve config currency pairs %v\n", err)
os.Exit(1)
}
portfolioMap := make(map[currency.Code]PortfolioTemp)
total := float64(0)

View File

@@ -97,11 +97,17 @@ func main() {
resp.Body.Close()
log.Println("Connected to websocket!")
hash, err := crypto.GetSHA256([]byte(cfg.RemoteControl.Password))
if err != nil {
log.Println("Unable to generate SHA256 hash from remote control password:", err)
return
}
log.Println("Authenticating..")
var wsResp WebsocketEventResponse
reqData := WebsocketAuth{
Username: cfg.RemoteControl.Username,
Password: crypto.HexEncodeToString(crypto.GetSHA256([]byte(cfg.RemoteControl.Password))),
Password: crypto.HexEncodeToString(hash),
}
err = SendWebsocketEvent("auth", reqData, &wsResp)
if err != nil {