Found it. os.Truncate 
Sets a file to a specific length. Replaced the null-insertion code to do that instead. 
Should be portable, maybe.
The python implementation isn't, but there is no note specifying otherwisein the Golang documentation. We'll have to see.