Sunday, March 19, 2023
HomeGolangExactly how to accumulate worths from a network right into a piece...

Exactly how to accumulate worths from a network right into a piece in Go? (I desire an energy approach, perhaps from go-funk) – Obtaining Aid

Does go-funk have anything to accumulate worths from a network right into a piece in Go? Any kind of collection that has?

I do not intend to execute this myself-

Why do you not intend to execute this on your own? It appears you might simply do this:

 func readEverythingFromChannel( ch chan * Something) [] * Something {
somethings:= make([] * Something).
for s:= array ch {
somethings = append( somethings, s).
return somethings.

Hi @skillian

why create 7 even more lines right into a documents, each time you require to fix the exact same issue? Exists a collection that currently does this?

I think all of us have various point of views. From my viewpoint, the inquiry would certainly be “why depend upon a collection when I can create 7 lines?”

Not to enter a debate, however taking into consideration that in @heidi‘s last blog post, they claimed:

I assume it could be appropriate to price estimate among the Go adages: ” A little duplicating is far better than a little dependence”

That being claimed, I am not familiar with any kind of collection that does this, however a few of the tasks that intend to make Go even more practical may approve a PUBLIC RELATIONS. In Go 1.18 as well as later on, you might develop your very own plan as well as placed a common variation of the code I place above and after that reference it from your various other tasks to make sure that you do not need to create it once more.

1 Like


There are advantages and disadvantages to both choices. I assume this is a place where each designer, or group selects its very own on a situation by instance circumstance.

Anyways, what is the remedy? I had expect go-funk however undoubtedly it appears that it can refrain from doing this.

Is the writer of go-funk analysis this online forum? I might offer you a hand.


Most Popular

Recent Comments