To grow a slice, as a programmer you would do:
myslice = append(myslice, value)
myslice = append(myslice, anotherslice...)
Or you can do this my hand, by allocating a new slice of the required size,
and copying the elements you want to keep.
There is a great overview of how this works internally at
https://blog.golang.org/slices
Also interesting: https://github.com/golang/go/wiki/SliceTricks
To grow a map you just set a key to a value. There is outline information
here: https://blog.golang.org/maps
I'm sure I read an article which went into detail about the hashing
algorithm, and under what conditions the hash grows, but I can't find it
now.
The details are of course in the source code:
https://github.com/golang/go/blob/master/src/runtime/map.go
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/6d98c221-64eb-4480-aa86-378e0455bc41o%40googlegroups.com.