我觉得这是一个非常简单的代码,但它似乎不起作用。
我有一个API给我的结构:
// Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1.
Count *int32 `json:"count,omitempty"`
但是当我尝试创建它时,如下所示:
agentPoolProfile := containerservice.ManagedClusterAgentPoolProfileProperties{
Count: int32(0)}
我收到以下错误:
cannot use int32(0) (constant 0 of type int32) as *int32 value in struct literal
我敢肯定,对于那些熟悉go的人来说,这是一个1秒的修复程序。但是:a)为什么在结构中铸造不起作用?b) “*”在这个结构中做什么?c)这是惯用语吗?那就是 - 我应该只写所有的值,如?agentPoolProfile.Count = *int32(0)
肥皂起泡泡
相关分类