As the previous posters have mentioned, it depends on the type of loach that you have. For example, dojo loaches don't eat algae and will eat the same diet as your goldfish. My dojos love gel food, shrimp pellets and ProGold pellets
On the other hand, Chinese hillstream loaches are primarily algae eaters, but will eat pellets and veggies after they have been in captivity for a while. Your tank should have a good coating of algae before you introduce hillstream loaches.