-1

Just 2 lines of code:

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

Go prints:

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

So how to fix it? Thanks a lot.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Troskyvs
  • 7,537
  • 7
  • 47
  • 115

1 Answers1

1

When you initialize an anonymous struct, you have to initialize the member fields of that struct:

var v4 interface{}=struct{x int}{x:1} // line 14
var v5 interface{}=&struct{x int}{x:1} // line 15
Burak Serdar
  • 46,455
  • 3
  • 40
  • 59