I wanted to deploy the API made with Go to Heroku,
git push heroku main
I gave a command
!     Push rejected, failed to compile Go app.
!     Push failed
Failed with the above error.
Looking back at the log,
-----> 
 !!    The go.mod file for this project does not specify a Go version
 !!    
 !!    Defaulting to go1.12.17
 !!    
 !!    For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
 !!    
-----> New Go Version, clearing old cache
There was a description like. At first I didn't think this was the cause, so I left it alone, but I decided to give it a try.
If you look it up, you can use go.mod to specify the go version on Heroku.
go.mod
module xxxx
// +heroku goVersion go1.15      <--add to
go 1.15
It seems that it needs to be described as. After rewriting and pushing again, I was able to deploy successfully.
Recommended Posts