Is this valid syntax for initializing a struct in Go?
id := struct { name, ltype, value }
The fields are all strings. The actual error message I get is "syntax error: unexpected }". Maybe you cant initialize anonymous structs this way ?
Is this valid syntax for initializing a struct in Go?
id := struct { name, ltype, value }
The fields are all strings. The actual error message I get is "syntax error: unexpected }". Maybe you cant initialize anonymous structs this way ?
收起
No type inference for you!
name := "a"
ltype := "b"
value := "c"
id := struct { name, ltype, value string } { name, ltype, value }
报告相同问题?