My daughter's dog, Shasha was having horrible gas. She was feeding her dog Kirkland Lamb and Rice (from Costco) and the gas was disgusting. She switched to Kirkland Chicken and Rice and it was worse, so she switched back. Shasha finally stopped eating her food.
My daughter has taken Shasha off Kirkland and is now feeding her Natural Balance, grain free brand. The gas is gone and Shasha is eating again.
I did some research and found that a lot of dogs have gas on Kirkland Dog Food and also on Diamond Dog Food, who makes Kirkland. Something is in the food to cause such a reaction. It does contain some ingredients that are not good for your dog, like meat "meal", beet pulp, chicken fat and salt, to name a few.
So, if your dog has gas and you are feeding Kirkland, switch to a higher quality food and try a grain free brand and see if the gas goes away.