diff --git a/cloudwatch/cloudwatch.go b/cloudwatch/cloudwatch.go index 38fb89a3..ce9e21a9 100644 --- a/cloudwatch/cloudwatch.go +++ b/cloudwatch/cloudwatch.go @@ -283,9 +283,9 @@ func (c *CloudWatch) ListMetrics(req *ListMetricsRequest) (result *ListMetricsRe err = c.query("GET", "/", params, &result) metrics := result.ListMetricsResult.Metrics if result.ListMetricsResult.NextToken != "" { - params = aws.MakeParams("ListMetrics") - params["NextToken"] = result.ListMetricsResult.NextToken for result.ListMetricsResult.NextToken != "" && err == nil { + params = aws.MakeParams("ListMetrics") + params["NextToken"] = result.ListMetricsResult.NextToken result = new(ListMetricsResponse) err = c.query("GET", "/", params, &result) if err == nil {