replace generate.sh shell script with Go code