Reputation: 35734
type MyType interface {
MyStringSlice []string
}
What is wrong with this?
It works well as a struct as in:
type MyType struct {
MyStringSlice []string
}
but compiles with the following error when set as interface:
syntax error: unexpected [, expecting (
Upvotes: 2
Views: 84
Reputation: 1996
An interface can only hold methods or other interfaces. Have a look at the Language Specification.
Upvotes: 4