为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.

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...