简体   繁体   中英

How to deploy Go server on Heroku with a MySQL database?

I am a complete beginner at hosting applications right now but am trying to get a hold of it. - I have the MySQL database running locally on my PC. How to exactly should I host it somewhere online. - When I tried to deploy my Go server on Heroku, I got the following error and couldn't find a solution for it anywhere online.

-----> App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/go.tgz More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure ! Push failed

Any help in this regard would be appreciated!

要解决此问题,您需要使用一些 vendoring 工具 - 例如 Godep、dep 等。 Heroku 无法在没有“vendor”文件夹的情况下部署 golang 应用程序

just run this command:

go mod init [app-name]

this will create a go mod file and a go sum for you then run:

go get

to install those packages you called in your go app. developers usually use go mod init github.com/name/repo but go mod init [app-name] will do the job!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM