Hi Sue and welcome to the forum
And may I say that I am sorry to hear about the loss of your goldfish.
If your remaining goldfish is acting up, it could be due to the tank size as already mentioned, but it could also be down to the water quality. If you have a water test kit or a local store who can test a sample of your water, then please could you let us know the water parameters of ammonia, nitrite and nitrate as something could have spiked.
I had an incident with my goldfish where she acted extremely hyper and distressed, it was all down to a nitrite spike and was easily fixed with daily water changes until it had sorted itself out
With regards to tank size, I believe others have already advised this area.
May I also ask what type of goldfish you currently have? For fancy goldfish as Cheri pointed out, you need 80 litres/20 gallons for the first fish and then an additional 40 litres/10 gallons for any additional fish.
However if your fish is of the single tailed variety i.e. common/shubunkin/comet, then the situation is slightly different. While single tailed fish do well in tanks when they are young, eventually they need a large tank or pond.
So knowing what type of fish you have, will help us give you better advice