我正在通过 Heroku 部署应用程序。
我愿意git push heroku master
我收到此错误:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching stdlib.sh.v8... done
remote: ----->
remote: Detected go modules via go.mod
remote: ----->
remote: Detected Module Name: go-getting-started
remote: ----->
remote: !! The go.mod file for this project does not specify a Go version
remote: !!
remote: !! Defaulting to go1.12.7
remote: !!
remote: !! For more details see: https://devcenter.heroku.com/articles/go-a
ps-with-modules#build-configuration
remote: !!
remote: -----> New Go Version, clearing old cache
remote: -----> Installing go1.12.7
remote: -----> Fetching go1.12.7.linux-amd64.tar.gz...
remote: gzip: stdin: not in gzip format
remote: tar: Child returned status 1
remote: tar: Error is not recoverable: exiting now
remote: ! Push rejected, failed to compile Go app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to autoattack.
我认为这是新 Go 版本的问题,因此我想使用以前的版本。
这是我的 go.mod 文件:
module go-getting-started
go 1.12
...
我尝试改变go 1.12
to go 1.11
但它不起作用。
您可以添加一个指令// +heroku goVersion go1.11
在你的go.mod
file.
module somemodule
// +heroku goVersion go1.11
go 1.11
require (
// ...
)
那么它应该看起来像这样。
remote: Detected go modules via go.mod
remote: ----->
remote: Detected Module Name: somemodule
remote: ----->
remote: -----> New Go Version, clearing old cache
remote: -----> Installing go1.11
文档:https://github.com/heroku/heroku-buildpack-go#go-module-specifics https://github.com/heroku/heroku-buildpack-go#go-module-specifics
Go 模块细节
您可以通过以下方式指定特定的封装规格go.mod
file's // +heroku install
指令(见下文)。
// +heroku goVersion <version>
: 你会使用的 go 的主要版本
就像 Heroku 在编译代码时使用的那样。如果没有指定这个
默认为构建包的 [DefaultVersion]。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)