Go
To use our example repositories, you must create a MyKinsta account. This is an example of how to set up a Go application to deploy on Kinsta’s Application Hosting services from a Git repository.
- In MyKinsta, click Applications > Add application > select Git repository > Public repository, and complete as follows:
- Repository URL: https://github.com/kinsta/hello-world-go
- Branch: main
- Enter an Application name and choose a Data center location. Leave all other settings as default and click Continue on each step.
- On the Summary step, click Deploy now.
During deployment, Kinsta automatically detects the Start command for the web process and installs dependencies defined in your go.mod file. The app is available as soon as the deployment finishes, and the Kinsta Welcome page loads at your application’s URL.
![Kinsta Welcome page after successful deployment of Go.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fapplication-go.png&w=3840&q=75)
Prefer to watch the video version?
Web Server Setup
Port
Kinsta automatically sets the PORT
environment variable. You do not need to define it or hard-code it into the application. Use os.Getenv("PORT")
in your code when referring to the server port.
Start Command
For this application, the Start command can be left blank. When you add the application, Kinsta automatically detects the required start command for the web process during the first deployment.