Revert "Ensure valid package names in generator and don't import 'fmt' if not used"

This reverts commit 2b70631399fa6d749f15c0e833eabcd446089663.