Skip to content

Commit

Permalink
Cannot return json.Unmarshal and fix variables not used
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bouchare committed Aug 9, 2019
1 parent dcb96e7 commit df27bb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ip_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func (client *Client) GetIPRanges() (*IPRanges, error) {

baseURL := client.GetBaseUrl()

urlIPRanges := ""
var urlIPRanges string

// Check if we're looking at the IP ranges for EU or US using the BaseURL domain
if strings.Contains(baseURL, ".eu") == true {
urlIPRanges := "https://ip-ranges.datadoghq.eu"
urlIPRanges = "https://ip-ranges.datadoghq.eu"
} else {
urlIPRanges := "https://ip-ranges.datadoghq.com"
urlIPRanges = "https://ip-ranges.datadoghq.com"
}

// HTTP request to inspect the response's body
Expand Down Expand Up @@ -70,5 +70,7 @@ func (client *Client) GetIPRanges() (*IPRanges, error) {

// Unmarshal the response body into the IPRanges struct
var ipRanges IPRanges
return json.Unmarshal([]byte(body), &ipRanges), nil
json.Unmarshal([]byte(body), &ipRanges)

return &ipRanges, nil
}

0 comments on commit df27bb6

Please sign in to comment.