Could not easily find info on how to create a self-invoking func in Golang.
My end-goal is to export a map from a file, something like this:
type Foo struct {}
type Bar struct {}
var TypeMap map[interface{}]string;
func selfInvoking(){
TypeMap = map[interface{}]string{
Foo: "foo",
Bar: "bar"
}
}()
how can I go about exporting a populated map like this from a file in Go? It's basically for one-time configuration.
Using the pattern above, I will get
"unused variable TypeMap".