Deploy your Go app to Heroku by adding a Procfile and using the Heroku Go buildpack.
- Create a file named
Procfilein your project root with the contentweb: go run main.go. - Initialize a Git repository and commit your code with
git initandgit add .followed bygit commit -m "initial commit". - Log in to Heroku with
heroku login. - Create a new Heroku app with
heroku create your-app-name. - Set the Go buildpack with
heroku buildpacks:set heroku/go. - Push your code to deploy with
git push heroku main.