How to return values from goroutines?

The below code gives compilation error saying 'unexpected go':
x := go doSomething(arg) func doSomething(arg int) int{ ... return my_int_value }

I know, I can fetch the return value if call the function normally, without using goroutine. Or I can use channels etc.

My question is why is it not possible to fetch a return value like this from a goroutine.

Write your answer...

Never miss a post from Aditya Agrawal, when you sign up for Ednsquare.