a small part of the ball has not crossed the goal line?
A goal is not awarded.
an attacking team player commits an offence (e.g. handball, foul, offside) before the ball crosses the goal line?
The goal is disallowed.
the referee awards a goal and then finds out (e.g. from an assistant referee, 4th official or the VAR) that an offence was committed by the attacking team before the ball crossed the goal line?
If the game has not restarted, the goal is disallowed.
If the game has restarted, the goal stands, and the matter is reported to the appropriate authorities after the game.
a defending team player commits an offence (e.g. handball, foul) before the ball crosses the goal line?
The referee does not penalise the offence but plays advantage and the goal is awarded.