General purpose file generation based on go templates