Your fish may be suffering from Goldfish Hypoxia, a lack of oxygen, if they are swimming exclusively at the surface of your tank, hanging around the filter outlet and gasping for air.
The most common reason is that your water has too little dissolved oxygen. They are hanging around the filter outlet because this is the best oxygenated spot in your tank. You can measure the oxygen level with a test kit from your local or online pet store. If less than 4ppm do a partial water change and add an aeration stone.
Check your water temperature. Your water may be too warm. The cooler the water the more oxygen is dissolved. Goldfish do not usually require heated water and are very sensitive to these changes.
Check your fish for any gill illness. Look for parasites or growths. If seen then treat appropriately with medications form online or local pet store.