title: Golang channels make program wait indefinitely
body: <p>I am working on a program with a manager/worker style setup. It has <code>n</code> number of workers that get data from an http source, push the data onto a gameData channel, pull url information off of a urlData channel and repeat. I then have one goroutine that is supposed to be parsing the data from the api that pulls from the channel gameData and pushes urls onto urlData channel.</p>
  
  <p>My problem is that the second time either goroutine tried to push something onto one of the channels, the goroutines halt and I have to kill the program.</p>
  
  <p>Here is some of the code and a link to the repo: <a href="https://github.com/gaigepr/lolTeams" rel="nofollow">https://github.com/gaigepr/lolTeams</a></p>
  
  <p>EDIT:</p>
  
  <p>After reading the comments about using buffered channels, the problem is obviously a deadlock. However, making the channels buffered just makes the deadlock take longer to happen.</p>
  
  <p>At this point is synchronizing the parser and getgames threads the way to go to ensure no deadlocks?</p>
  
  <p>EDIT2:</p>
  
  <p>I refactored the program so that now I am using a threadsafe queue to store the summonerID as well as each worker thread now calls the parser function on its own data. This simplified things in a good way. I did this because I was unable to work around the playerChan eventually filling up because of the nature of the data accumulating. unless someone has a reason not to, I will leave this question open to see if someone has an answer that solves to channel problem.</p>