Skip to content

Instantly share code, notes, and snippets.

@farkaskid
Last active April 5, 2019 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farkaskid/66171850ee0d967489b212f9d7c54743 to your computer and use it in GitHub Desktop.
Save farkaskid/66171850ee0d967489b212f9d7c54743 to your computer and use it in GitHub Desktop.
Goroutine example.
// This function performs the given task concurrently by spawing a goroutine
// for each of those tasks.
func performAsyncTasks(task []Task) {
for _, task := range tasks {
// This will spawn a separate goroutine to carry out this task.
// This call is non-blocking
go task.Execute()
}
}
@didi-rare
Copy link

Hi Farkaskid,

read your medium post and i just wanted to commend you for it.
I noticed a mistake in this example, i generally get the idea, but so it's not confusing for newbie, i just want to point it out.

The parameter name for performAsyncTasks() should be tasks instead of task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment