several workers performing lots of tasks that each loop over that large
array of strings. To ensure that I dont copy my very large array of strings
over to each worker, each worker has a channel of type chan *string. Each
string is my master list is pumped into each workers channel. As far as my
understanding goes, this means that each workers channel is very light as
the dont have a copy of each string, just a reference to the master list.
Each worker then pulls a string pointer from the channel, does some work
(that doesnt modifiy the string) and then moves on to the next job in the
My problem is this: some of the work requires that I slice the string
returned from the channel, as I want to read say x characters from the
string over a loop. However, I get an error trying to slice *string. What
would you guys recommend as the best way to proceed?
I could copy the string in the worker once its pulled off the channel, but
that kinda feels like cheating and I wondered if there was a better
technique I was missing that wouldnt require me to may a temporary copy of
the string from the master list, as I may have several hundred workers.
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@example.com.
For more options, visit https://groups.google.com/d/optout.