aws/ec2metadata: Improve readability of API Send calls
Updates the EC2 Metadata client's request methods to call `req.Send` outside of the `return` expression to improve clarity of the expected behavior that `output.Content` would be populated within `Send`'s invoke.
@@ -24,8 +24,9 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) {
output := &metadataOutput{}
req := c.NewRequest(op, nil, output)
+ err := req.Send()
- return output.Content, req.Send()
+ return output.Content, err
}
// GetUserData returns the userdata that was configured for the service. If
@@ -45,8 +46,9 @@ func (c *EC2Metadata) GetUserData() (string, error) {
r.Error = awserr.New("NotFoundError", "user-data not found", r.Error)
}
})
+ err := req.Send()
- return output.Content, req.Send()
+ return output.Content, err
}
// GetDynamicData uses the path provided to request information from the EC2
@@ -61,8 +63,9 @@ func (c *EC2Metadata) GetDynamicData(p string) (string, error) {
output := &metadataOutput{}
req := c.NewRequest(op, nil, output)
+ err := req.Send()
- return output.Content, req.Send()
+ return output.Content, err
}
// GetInstanceIdentityDocument retrieves an identity document describing an
