Difference between a chi-square test for independence and a chi-square goodness of fit test.

Explain the difference between a chi-square test for independence and a chi-square goodness of fit test. How would you know which test to use? As a researcher, explain the different variables you would use for each test and why.