Let's say that A and B are two different kinds of foods. Which is grammatically correct?
A goes good with B.
A goes well with B.
If they're both correct, then which is better?
Grammatically, "goes well" is the correct choice.
The definition of "Good", when used as an adverb, is actually "well".
Of course, if "Good" is used as an adjective it can have a very similar definition to when it used as an adverb.
When to use good vs. well is a common problem, including for native speakers who occasionally get this wrong. As About.com explains:
Good is an adjective and well is an adverb. Many people, including many native speakers, incorrectly use the adjective form good, rather than the adverb well.
So, some examples of each in usage are:
That is a good song. (Good is modifying the noun, song.)
You sang the song very well. (Well is modifying the verb, sang.)
The bike is pedaling well. (Well is modifying the verb, pedaling.)
The car is in good shape. (Good is modifying the noun, shape.)
In your case, you are describing a relationship between A and B. Taking out either good or well, you have "A goes with B". Now, in the sentence you are trying to write, you are describing how A goes with B. "Goes" is a verb, so you are looking for an adverb. Thus the correct phrase is:
A goes well with B.
Another way to think about when to use well: If you can ask the phrase as a how question, you should use well. For example:
How does A go with B? A goes well with B.
Side note: There are some cases in which good almost acts as an adverb. The rule between good and well here is:
With the four senses—look, smell, taste, feel—discern if these words are being used actively to decide whether to follow them with good or well.
You smell good today. Good describes you, not how you sniff with your nose.
You smell well for someone with a cold. You are sniffing actively with your nose here so use the adverb.
She looks good for a 75-year-old grandmother. She is not looking actively with eyes so use the adjective.
While the dictionary lists well as the adverb definition for good, note that this is very informal and likely to be marked as wrong by some native speakers.
A: ...goes well with...Aka integrates well
B: ...goes good with...aka complements well
Good is not taking advantage of hospitality others give because they would sacrifice their code for yours.
Well is being accepted as for who you are in the company of others who are fixed in their code.
This made no sense only to those that misunderstand my methodology, which is based on my experience of the words rather that a static view of the words; I bring together the various usages in a common thread.
The flaw is the communicative efficiency of my answer. I will improve that, no doubt I will.