>>5510585Ask the tugas. The g can also make antoher sound when next to an a, o or u (Gato, Goteira, Singular). When it's next to an -ue, it the same sound as in "burger", and when next to an -ui, it has the same sound as in "girl".
I forgot it's also mandatory to use it when the noun ends with -ágio, -égio, -ígio, -ógio and -úgio