If one starts laying eggs there a fairly good chance its a female and call me suspicious but in that situation, if they grow into fish id be compeled to say the other was a male
This is about as technical as ive ever got to sexing fish.
Someone will be along with a "proper" answer soon but i suspect it will be very difficult but something to do with certain fin sizes and body shape.
Males get spots on their gill plates and down through the pectoral fins as well. Sometimes its been confused with ich, but if theres only spots in this this area then its breeding stars *tubercles*.
Males also have thickening of the front ray of the pectoral fins as well, but really only noticeable along with the breeding stars.
Females tend to get rounder and fuller in the middle and they have what is described as an outie. This is a small protrusion from the backend and the male has his going inward and you may notice a more concave look in this area of the male.
Goldfish are usually sexually mature at 3 years old or when younger they have grown to a good size. Its not uncommon for yearling fish to breed.