Did you take on the fish, tank etc? Or is it a new set up? New tank, filter etc?
Do you have any idea what your water parameters are?
Bits of your goldfish turning black is a sign of ammonia being too high, which in turn is a sign your tank isnt cycled. In the short term, plenty of water changes are the best thing you can do. For the time being change half the water every day.
Going forward, im conscious that the situation has kind of been forced on you, but a 10g tank isnt going to be big enough for a goldfish. In a suitable environment, goldfish get big and live decades. They are also very messy. The upshot is they need a lot of space, ultimately a tank 3x bigger than you have for just one goldfish. How big is the fish currently? Do you have any idea how old it is? I dont really want to assume how commited you are to caring for this fish in terms of time, money and space.
If you are committed to the care of the fish, then i would get a water test kit. We can then determine if your tank is cycled. API freshwater master test kit is a good one to go for.
I can post some information about the nitrogen cycle if you want to learn about whats going on in the tank. In the meantime here's a link about what to do if you find yourself the owner of a goldfish which contains a lot of useful information.
https://www.aquariumadvice.com/forum...re-377527.html