我正在使用CreateSecurityGroup功能在戈朗使用goamz。以下是函数签名:
func (ec2 *EC2) CreateSecurityGroup(name, description string) (resp *CreateSecurityGroupResp, err error)在这个参数列表中,参数name有什么类型?
发布于 2014-10-21 10:41:35
方法签名的功能的规范允许参数使用一种
ParameterDecl = [ IdentifierList ] [ "..." ] Type .name, description是标识符列表。string是应用于该列表的类型。对于变量声明,您有相同的特性
var U, V, W float64这三个变量都具有相同的float64类型。
注意:最近版本的goamz源代码显示了具有不同参数的相同方法:请参见提交04a8dd3
func (ec2 *EC2) CreateSecurityGroup(group SecurityGroup)
(resp *CreateSecurityGroupResp, err error) {...通过以下方式:
type SecurityGroup struct {
Id string `xml:"groupId"` + Id string `xml:"groupId"`
Name string `xml:"groupName"` + Name string `xml:"groupName"`
Description string `xml:"groupDescription"`
VpcId string `xml:"vpcId"`
}当潜在参数的数量增加时,这是典型的情况:将它们包装在一个结构中。
在这个测试中使用
resp, err :=
s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: "websrv",
Description: "Web Servers"})https://stackoverflow.com/questions/26484234
复制相似问题