1
0
Fork 0

formatting

This commit is contained in:
Massaki Archambault 2021-12-24 16:03:32 -05:00
parent a0430b6c1e
commit 7cdb43b395
6 changed files with 14 additions and 28 deletions

View File

@ -21,8 +21,7 @@ func GetAccountForAddress(account string) (*Account, error) {
// unmarshal the response // unmarshal the response
respobject := AccountResp{} respobject := AccountResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
@ -53,8 +52,7 @@ func GetActivityForAccount(account string, filterTypes []string, minTime *time.T
combinedResp := activity.ActivityResp{} combinedResp := activity.ActivityResp{}
for _, respBody := range resBodies { for _, respBody := range resBodies {
activityResp := activity.ActivityResp{} activityResp := activity.ActivityResp{}
err = json.Unmarshal(respBody, &activityResp) if err := json.Unmarshal(respBody, &activityResp); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
combinedResp.Data = append(combinedResp.Data, activityResp.Data...) combinedResp.Data = append(combinedResp.Data, activityResp.Data...)
@ -75,8 +73,7 @@ func GetActivityCountsForAccount(account string) (*ActivityCounts, error) {
// unmarshal the response // unmarshal the response
respobject := ActivityCountsResp{} respobject := ActivityCountsResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
@ -95,8 +92,7 @@ func GetHotspotsForAccount(account string) ([]Hotspot, error) {
// unmarshal the response // unmarshal the response
respobject := AccountHotspotsResp{} respobject := AccountHotspotsResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }

View File

@ -23,8 +23,7 @@ func GetHeight(maxTime *time.Time) (int, error) {
// unmarshal the response // unmarshal the response
respobject := HeightResp{} respobject := HeightResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return -1, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return -1, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }

View File

@ -33,8 +33,7 @@ func GetHotspotActivity(hotspot string, filterTypes []string, minTime *time.Time
combinedResp := activity.ActivityResp{} combinedResp := activity.ActivityResp{}
for _, respBody := range resBodies { for _, respBody := range resBodies {
activityResp := activity.ActivityResp{} activityResp := activity.ActivityResp{}
err = json.Unmarshal(respBody, &activityResp) if err := json.Unmarshal(respBody, &activityResp); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
combinedResp.Data = append(combinedResp.Data, activityResp.Data...) combinedResp.Data = append(combinedResp.Data, activityResp.Data...)
@ -55,8 +54,7 @@ func GetHotspotActivityCounts(hotspot string) (*ActivityCounts, error) {
// unmarshal the response // unmarshal the response
respobject := ActivityCountsResp{} respobject := ActivityCountsResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
@ -75,8 +73,7 @@ func GetWitnessesForHotspot(hotspot string) ([]Hotspot, error) {
// unmarshal the response // unmarshal the response
respobject := WitnessesResp{} respobject := WitnessesResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }
@ -95,8 +92,7 @@ func GetWitnessedForHotspot(hotspot string) ([]Hotspot, error) {
// unmarshal the response // unmarshal the response
respobject := WitnessedResp{} respobject := WitnessedResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }

View File

@ -17,8 +17,7 @@ func GetCurrentOraclePrice() (*CurrentOraclePrice, error) {
// unmarshal the response // unmarshal the response
respobject := CurrentOraclePriceResp{} respobject := CurrentOraclePriceResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }

View File

@ -53,8 +53,7 @@ func getHeliumApi(path string, params *map[string]string) ([]byte, error) {
} }
// ensure we respect the rate limit // ensure we respect the rate limit
err := Limiter.Wait(context.Background()) if err := Limiter.Wait(context.Background()); err != nil {
if err != nil {
return nil, err return nil, err
} }
@ -111,8 +110,7 @@ func getHeliumApiWithCursor(path string, params *map[string]string) ([][]byte, e
for { for {
// ensure we respect the rate limit // ensure we respect the rate limit
err := Limiter.Wait(context.Background()) if err := Limiter.Wait(context.Background()); err != nil {
if err != nil {
return nil, err return nil, err
} }
@ -138,8 +136,7 @@ func getHeliumApiWithCursor(path string, params *map[string]string) ([][]byte, e
// parse the response body for a cursor // parse the response body for a cursor
respCursor.Cursor = "" respCursor.Cursor = ""
err = json.Unmarshal(body, &respCursor) if err := json.Unmarshal(body, &respCursor); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", req.URL.String(), err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", req.URL.String(), err)
} }

View File

@ -17,8 +17,7 @@ func GetBlockchainStats() (*BlockchainStats, error) {
// unmarshal the response // unmarshal the response
respobject := BlockchainStatsResp{} respobject := BlockchainStatsResp{}
err = json.Unmarshal(respBody, &respobject) if err := json.Unmarshal(respBody, &respobject); err != nil {
if err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err) return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
} }