Compatibility depends on the temperament of the individual fish.
Goldfish also generate huge waste which can contaminate the water quickly. This, however, can be addressed by changing the water more frequently.
Hence, it depends on the individual fish. It is not advisable to keep the two species together. If you must, you can try keeping them if you have a big tank where each fish can keep to its own area with lots of plants.