Late in a losing game, you sometimes see the goalkeeper sprint the length of the pitch for a last corner while someone else pulls on the gloves. It looks chaotic. It is entirely legal.