What most people dont realize is that goldfish grow to be a foot long. So imagine a foot long gold fish living inside that aquarium. Will it be comfortable? Does it have room to swim around?
I know they start out small, but they will grow. And that saying about a fish will grow to the size of its container is misleading. While a fish may slow down or stop its growth if the tank is too small, they will start to suffer internal organ damage and die slowly and painfully.
Back to your question about a lid. I believe that goldfish, as part of the carp family, are prone to jumping. So a cover for the aquarium is probably a good idea.
My best advice would be to look into getting something appropriate to the size of the tank.