I'm trying to get the data which is stored in interface[] back to string array. Encountering an unexpected error.
type Foo struct { Data interface{} } func (foo Foo) GetData() interface{} { return foo.Data } func (foo *Foo) SetData(data interface{}) { foo.Data = data } func main() { f := &Foo{} f.SetData( []string{"a", "b", "c"} ) var data []string = ([]string) f.GetData() fmt.Println(data) } Error: main.go:23: syntax error: unexpected f at end of statement