How to execute multiple query by using go routine

Arguably the right answer would (as @Dean_Davidson said) indeed be to just:

  • use the main routine

but also:

  • do the data processing with an appropriate SQL query (only using Go for the final steps)

After all, SQL basically is a domain-specific data-processing language.

Also, database-systems have their own concurrency-mechanisms (transactions, ACID, …) so you might not need to depend on the Go mechanics for this.