doukuang1950 2019-07-10 10:33
浏览 407

为go.mod文件指定Go版本

I am deploying an application through Heroku. I do git push heroku master

And I get this error:

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.

I think it's a problem with the new Go version and for this reason I want to use a previous one.

This is my go.mod file:

module go-getting-started

go 1.12

...

I tried to change go 1.12 to go 1.11 but it doesn't work.

  • 写回答

1条回答 默认 最新

  • douyalin2258 2019-07-10 11:00
    关注

    You can set the Go version to be used by adding a GOVERSION environment variable. You can do this on the Heroku Settings page of your project.

    You may set the previous (working) revision by adding GOVERSION=go1.12.6.

    This is documented at Heroku Go Support: Go versions:

    If you need to select a specific minor revision (e.x. go1.8.7) for any reason you will need to hand edit the appropriate metadata file or set the $GOVERSION environment variable...

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记