Answer the question
In order to leave comments, you need to log in
How to get sequential data from go func()?
Hello!
The code:
var st make([]string, 0)
for _, word := range stro {
sts, err := au(word , na , la, ge)
st = append(st, sts)
}
for _, word := range stro {
func() {
sts, err := au(word , na , la, ge)
st = append(st, sts)
}()
// st обработка
}
Answer the question
In order to leave comments, you need to log in
You have the output in an array, with the element numbers corresponding to the output. Therefore, it will be easiest to put them directly in the desired cells.
st := make([]string, len(stro))
for i := range stro {
func(i int) {
word := stro[i]
sts, err := au(word, na, la, ge)
if err != nil {
// .....
}
st[i] = sts
}(i)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question