1
When we have a method like this:
func (vu *VideoUpload) ProcessUpload(concurrency int, doneUpload chan string) error {
in := make(chan int, runtime.NumCPU())
returnChannel := make(chan string)
err := vu.loadPaths()
if err != nil {
return err
}
uploadClient, ctx, err := getClientUpload()
if err != nil {
return err
}
for process := 0; process < concurrency; process++ {
go vu.uploadWorker(in, returnChannel, uploadClient, ctx)
}
go func() {
for x:= 0; x < len(vu.Paths); x++ {
in <- x
}
close(in)
}()
for r := range returnChannel {
if r != "" {
doneUpload <- r
break
}
}
return nil
}
But he’s called a go routine:
go videoUpload.ProcessUpload(concurrency, doneUpload)
How can we treat this error? Because we usually do:
err := vu.loadPaths()
if err != nil {
return err
}
I can speak for myself, usually what I do is put a call to some log base, where I can check the data in a second moment. I believe that the golang way to treat this flow would be to use Channels to communicate between processes. But I never used this language functionality. :-/
– Danizavtz