Go 匿名结构无法使用复合文字进行编译

Go 匿名结构无法使用复合文字进行编译,go,struct,interface,literals,composite,Go,Struct,Interface,Literals,Composite,只有两行代码: var v4 interface{}=strcut{x int}(1) // line 14 var v5 interface{}=&strcut{x int}(1) // line 15 Go打印: my_test.go:14:29: missing ',' in composite literal my_test.go:15:30: missing ',' in composite literal 那么如何修复它呢?非常感谢。初始化匿名结构时,必须初始化该结构的成

只有两行代码:

var v4 interface{}=strcut{x int}(1) // line 14
var v5 interface{}=&strcut{x int}(1) // line 15
Go打印:

my_test.go:14:29: missing ',' in composite literal
my_test.go:15:30: missing ',' in composite literal

那么如何修复它呢?非常感谢。

初始化匿名结构时,必须初始化该结构的成员字段:

var v4 interface{}=struct{x int}{x:1} // line 14
var v5 interface{}=&struct{x int}{x:1} // line 15

我正在使用Go 1.13,在我在操场上更改为{x:1}Works后仍然存在相同的错误:struct应该是struct!!!!!!!