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
respobject := AccountResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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{}
for _, respBody := range resBodies {
activityResp := activity.ActivityResp{}
err = json.Unmarshal(respBody, &activityResp)
if err != nil {
if err := json.Unmarshal(respBody, &activityResp); err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
}
combinedResp.Data = append(combinedResp.Data, activityResp.Data...)
@ -75,8 +73,7 @@ func GetActivityCountsForAccount(account string) (*ActivityCounts, error) {
// unmarshal the response
respobject := ActivityCountsResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
respobject := AccountHotspotsResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
respobject := HeightResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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{}
for _, respBody := range resBodies {
activityResp := activity.ActivityResp{}
err = json.Unmarshal(respBody, &activityResp)
if err != nil {
if err := json.Unmarshal(respBody, &activityResp); err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
}
combinedResp.Data = append(combinedResp.Data, activityResp.Data...)
@ -55,8 +54,7 @@ func GetHotspotActivityCounts(hotspot string) (*ActivityCounts, error) {
// unmarshal the response
respobject := ActivityCountsResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
respobject := WitnessesResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
respobject := WitnessedResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
respobject := CurrentOraclePriceResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
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
err := Limiter.Wait(context.Background())
if err != nil {
if err := Limiter.Wait(context.Background()); err != nil {
return nil, err
}
@ -111,8 +110,7 @@ func getHeliumApiWithCursor(path string, params *map[string]string) ([][]byte, e
for {
// ensure we respect the rate limit
err := Limiter.Wait(context.Background())
if err != nil {
if err := Limiter.Wait(context.Background()); err != nil {
return nil, err
}
@ -138,8 +136,7 @@ func getHeliumApiWithCursor(path string, params *map[string]string) ([][]byte, e
// parse the response body for a cursor
respCursor.Cursor = ""
err = json.Unmarshal(body, &respCursor)
if err != nil {
if err := json.Unmarshal(body, &respCursor); err != nil {
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
respobject := BlockchainStatsResp{}
err = json.Unmarshal(respBody, &respobject)
if err != nil {
if err := json.Unmarshal(respBody, &respobject); err != nil {
return nil, fmt.Errorf("failed to unmarshal response from %v: %v", path, err)
}