Use channel to get return value in goroutine, instead of shared variable