[英]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. - 我在我的 PC 上本地运行 MySQL 数据库。 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. - 当我尝试在 Heroku 上部署我的 Go 服务器时,出现以下错误并且无法在网上的任何地方找到解决方案。
-----> 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 mod 文件和一个 go sum 然后运行:
go get
to install those packages you called in your go app.安装您在 go 应用程序中调用的那些包。 developers usually use go mod init github.com/name/repo but go mod init [app-name] will do the job!开发人员通常使用 go mod init github.com/name/repo 但 go mod init [app-name] 可以完成这项工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.