Or initialize a map with your functions, and lookup in the map.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view
On Wed, Apr 29, 2020 at 02:17:44PM -0700, MichaelB wrote:
> I'm trying to store a data point as a JSON (w/struct) with a Call back
> function to call when the item is loaded with data
Functions aren't serializeable to json, it's not one of the types json supports.
> Just marshaling the struct
Hey Gophers,
I'm trying to store a data point as a JSON (w/struct) with a Call back
function to call when the item is loaded with data
Just marshaling the struct into JSON nets a blank item.. any suggestions?
example:
type Item struct {
name string
callback func()
data int
}
...
func