From 927740fb8122bca634492cc370cd7ced88497564 Mon Sep 17 00:00:00 2001 From: William Flores Date: Mon, 20 Jul 2020 12:47:58 -0700 Subject: [PATCH] fix: golang inspection errors --- cmd/crypto-sync/sync.go | 3 --- pkg/personalcapital/accounts.go | 2 +- pkg/personalcapital/client.go | 2 +- pkg/personalcapital/holdings.go | 16 ++++++++-------- pkg/personalcapital/login.go | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cmd/crypto-sync/sync.go b/cmd/crypto-sync/sync.go index bd1e8e0..e4bf9aa 100644 --- a/cmd/crypto-sync/sync.go +++ b/cmd/crypto-sync/sync.go @@ -46,9 +46,6 @@ func (s *SyncCmd) Run(ctx *Context) error { if holding == "coinbase" { pricingData = holdingsProvider.(holdings.Price) } - if err != nil { - return err - } uHolding, err := account.GetHoldings() if err != nil { return err diff --git a/pkg/personalcapital/accounts.go b/pkg/personalcapital/accounts.go index a7a8423..1193826 100644 --- a/pkg/personalcapital/accounts.go +++ b/pkg/personalcapital/accounts.go @@ -167,7 +167,7 @@ func (a *Accounts) GetAccounts(ctx context.Context, request *GetAccountsRequest) return nil, err } if resp.StatusCode != 200 { - return nil, errors.New("Non 200 response") + return nil, errors.New("non 200 response") } body, err := ioutil.ReadAll(resp.Body) if err != nil { diff --git a/pkg/personalcapital/client.go b/pkg/personalcapital/client.go index 9dba1a8..feea064 100644 --- a/pkg/personalcapital/client.go +++ b/pkg/personalcapital/client.go @@ -239,7 +239,7 @@ func SaveSession(inClient *http.Client, baseURL string, fileName string) { } // LoadSession loads the cookies from a previously saved session file. -func LoadSession(cookies *[]*(http.Cookie), fileName string) { +func LoadSession(cookies *[]*http.Cookie, fileName string) { cookiesFile, err := ioutil.ReadFile(fileName) if err != nil { log.Println(err) diff --git a/pkg/personalcapital/holdings.go b/pkg/personalcapital/holdings.go index 28118b6..311572c 100644 --- a/pkg/personalcapital/holdings.go +++ b/pkg/personalcapital/holdings.go @@ -121,7 +121,7 @@ func (h *Holdings) GetHoldings(ctx context.Context, params *GetHoldingsParams) ( return nil, err } if resp.StatusCode != 200 { - return nil, errors.New("Non 200 response") + return nil, errors.New("non 200 response") } body, err := ioutil.ReadAll(resp.Body) if err != nil { @@ -132,15 +132,15 @@ func (h *Holdings) GetHoldings(ctx context.Context, params *GetHoldingsParams) ( if err != nil { return nil, err } - holdings := new(GetHoldingsResponse) - holdings.SpData = ghr.SpData + lHoldings := new(GetHoldingsResponse) + lHoldings.SpData = ghr.SpData if params.FilterUserCreated { - holdings.Holdings = FilterHoldsFromUser(holdings.Holdings) + lHoldings.Holdings = FilterHoldsFromUser(lHoldings.Holdings) } if params.FilterAccountName != "" { - holdings.Holdings = FilterHoldsByAccountName(holdings.Holdings, params.FilterAccountName) + lHoldings.Holdings = FilterHoldsByAccountName(lHoldings.Holdings, params.FilterAccountName) } - return holdings, nil + return lHoldings, nil } func PCHoldingsToIHoldings(h []HoldingsType) []holdings.IHolding { @@ -261,7 +261,7 @@ func (h *Holdings) UpdateHoldings(ctx context.Context, holding HoldingsUpdateReq return nil, err } if resp.StatusCode != 200 { - return nil, errors.New("Non 200 response") + return nil, errors.New("non 200 response") } body, err := ioutil.ReadAll(resp.Body) if err != nil { @@ -357,7 +357,7 @@ func (h *Holdings) AddHolding(ctx context.Context, holding *HoldingAddRequest) ( return nil, err } if resp.StatusCode != 200 { - return nil, errors.New("Non 200 response") + return nil, errors.New("non 200 response") } body, err := ioutil.ReadAll(resp.Body) if err != nil { diff --git a/pkg/personalcapital/login.go b/pkg/personalcapital/login.go index 6bbc151..4faa5c7 100644 --- a/pkg/personalcapital/login.go +++ b/pkg/personalcapital/login.go @@ -103,7 +103,7 @@ func (a *Authentication) AuthenticateWithPassword(ctx context.Context, params Au } if resp.StatusCode != 200 { - return errors.New("Non 200 response") + return errors.New("non 200 response") } body, err := ioutil.ReadAll(resp.Body)