Golang struct literal syntax with unexported fields
问题 I've got a largish struct which until just now I was instantiating with the struct literal syntax, e.g.: Thing{ "the name", ... } I've just added an unexported field the Thing struct and now Go is complaining: implicit assignment of unexported field 'config' in Thing literal . Is there any way I can continue using the literal syntax even though there's now an unexported field on the struct? 回答1: You can only use composite literals to create values of struct types defined in another package if