Move the platform code into goplat.js