If your goldfish has a mouth sore the first thing you need to do it clean the tank of all bacteria to prevent the infection from spreading. Next feed the fish triple antibiotic fish food to cure the sore.
A goldfish with a mouth sore may possibly be more. It could possibly be a fungus growing on him which needs medication. Ask a local per store for more help.
There are very limited things that you can do in this case. I would watch the fish carefully and try to adjust what you are feeding it to whatever the fish can eat, probably flakes.