Instead of doing:
var adapters[]LogicAdapter
adapter1 := &ExampleAdapter{0.9}
adapter2 := &ExampleAdapter{0.8}
adapters = append(adapters, adapter1, adapter2)
bot := ChatterBot{"Charlie", MultiLogicAdapter{adapters}}
I tried:
bot := ChatterBot{
"Charlie",
MultiLogicAdapter{
[]LogicAdapter{
&ExampleAdapter{0.9},
&ExampleAdapter{0.8}
}
}
}
But why this won't work? I cannot see any problems with the syntax, it's like I were creating a new slice and putting it into there. Here are the errors:
./main.go:16: syntax error: unexpected semicolon or newline, expecting comma or }
./main.go:21: syntax error: unexpected semicolon or newline, expecting comma or }
./main.go:22: syntax error: unexpected semicolon or newline, expecting comma or }