This is the picture every Russian learns in 1st grade (7 years old)
Each consonant from the top row is pronunced unvoiced (substituted by letter from bottom row), if it's located at the end of closed syllable* (such as the consonant end of the word). We never say a voiced consonant in the word ending, and for children it's hard to write a word "год", because it does sound "гот". So we use another word form to check. For "год" it's "годы". For "гот", it's "готы". In open syllable, there are no doubts, each consonant is written as it sounds.
Here are some samples:
Furthermore, unvoicing consonants is so natural for Russians, that we have significant difficulties when learning to pronounce English "dog", "red" and etc. "Dok" and "ret" is the default option, hard to overcome for the beginners.
*Note: general "end of closed syllable" rule is good only for the beginners. Actually, not every closed syllable has the final consonant devoiced, if the next consonant is voiced there occurs no devoicing, like in "годный", "грабли", "бодрый", etc. The devoicing doesn't always occur even at the end of the word, e.g. "год и один месяц" – here "год" is pronounced as "год", not like "гот", the rule is: the devoicing occurs before a pause or before a voiceless consonant.