Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build on go1.11-1.11.3 because of "go 1.12" declaration in go.mod #345

Closed
brent-holland opened this issue Mar 19, 2019 · 24 comments
Closed
Assignees
Labels
type: process A process-related concern. May include testing, release, or the like.

Comments

@brent-holland
Copy link

Upgrading to go 1.12 broke compatibility with google functions, which only supports 1.11. I get the following error trying to deploy a golang google function using this library (which is, in turn used by google's bigquery library. I'm going to try to downgrade to an earlier version

Deployment failure:
Build failed: go: finding cloud.google.com/go/bigquery latest
go: finding cloud.google.com/go/functions/metadata latest
go: finding cloud.google.com/go v0.37.1
go: downloading cloud.google.com/go v0.37.1
go: finding github.com/googleapis/gax-go/v2 v2.0.4
go: finding github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024
go: finding golang.org/x/tools v0.0.0-20190312170243-e65039ee4138
go: finding golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
go: finding golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6
go: finding google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19
go: finding golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f
go: finding google.golang.org/api v0.2.0
go: finding golang.org/x/build v0.0.0-20190314133821-5284462c4bec
go: finding golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e
go: finding google.golang.org/appengine v1.4.0
go: finding golang.org/x/net v0.0.0-20190213061140-3a22650c66bd
go: finding golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961
go: finding golang.org/x/tools v0.0.0-20190226205152-f727befe758c
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: downloading google.golang.org/api v0.2.0
go: downloading google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19
go: downloading github.com/googleapis/gax-go v2.0.0+incompatible
go: downloading github.com/hashicorp/golang-lru v0.5.0
go: downloading github.com/googleapis/gax-go/v2 v2.0.4
go: downloading golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: downloading golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: downloading golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
go build google.golang.org/api/googleapi/internal/uritemplates: module requires Go 1.12
go build google.golang.org/api/iterator: module requires Go 1.12
go build google.golang.org/api/internal: module requires Go 1.12
go build google.golang.org/api/googleapi/transport: module requires Go 1.12
go build google.golang.org/api/transport/http/internal/propagation: module requires Go 1.12
@bradfitz
Copy link
Contributor

Upgrade your Go 1.11. That error message is a bug and was fixed in a Go 1.11.x point release.

@brent-holland
Copy link
Author

I'm not sure you understand. This error is happening when attempting to load my golang code into a google function. I have no control over the golang runtime used in the google function

@bradfitz
Copy link
Contributor

@jadekler @broady @andybons @stewblr -- which version of Go 1.11.x is Google Cloud Functions using? It might be too old.

@broady
Copy link
Contributor

broady commented Mar 19, 2019

Thanks, it looks like it's on Go 1.11.5 right now, though that was only updated a few days ago, so might not have hit production yet. Before that, it was on Go 1.11.0.

I just sent a change to update it to 1.11.6.

@stewartreichling
Copy link

We're in the process of updating to Go 1.11.5.

@bradfitz
Copy link
Contributor

Go 1.11.4 or later is fine per https://tip.golang.org/doc/go1.12#modules

@bradfitz
Copy link
Contributor

What were we on before "in the process of updating to Go 1.11.5"?

@broady
Copy link
Contributor

broady commented Mar 19, 2019

What were we on before "in the process of updating to Go 1.11.5"?

"Before that, it was on Go 1.11.0."

great, we're on track for 1.11.5 very soon, then, and we should be able to get to 1.11.6 a bit later.

@bradfitz
Copy link
Contributor

Sorry, I shouldn't reply to bugs while watching a meeting. 🙄

@jeanbza jeanbza added the type: process A process-related concern. May include testing, release, or the like. label Mar 19, 2019
@brent-holland
Copy link
Author

we're on track for 1.11.5 very soon

Not to press, but do we have an ETA as to when this will be available for use in GCP?

@stewartreichling
Copy link

stewartreichling commented Mar 19, 2019

Hi Brent,

I can't give a fixed timeline as it depends on some releases landing. This should hopefully make it into the next release. In the meantime, you could depend on an older version of the libs, e.g.,:

module my_module

require cloud.google.com/go v0.37.0

@brent-holland
Copy link
Author

@stewblr I tested and using this version did get my function working. Thank you for your help.

@stewartreichling
Copy link

Glad to hear the temporary fix worked.

@nanasi880
Copy link

I have the same problem with deployment to Google AppEngine ( Go1.11 runtime )
The workaround works but I hope it gets fixed.

@sbuss
Copy link

sbuss commented Mar 22, 2019

EDIT: This comment below is wrong, please disregard. I misconfigured my local installation. Go 1.11.4+ should handle this situation fine. The Go 1.11 runtime on Google App Engine has been running Go 1.11.5 since March 6, 2019 and should not have the problems described in this thread.

There's nothing to fix on the App Engine side for this -- the modules the user is depending on have declared that Go 1.12 is the minimum version supported so therefore it cannot build on Go 1.11. It was the choice of the modules' authors to not allow builds on anything before Go 1.12.

Background:
Go 1.12 introduced a new feature for go modules that allows you to declare the minimum version of Go necessary for the module. In Go 1.12 the default minimum value is Go 1.12. Therefore, any user migrating their code to use go modules will inadvertently break anyone using a version of go younger than Go 1.12.

Here's an example of someone using Go 1.12 creating their go.mod for the first time:

$ go mod init example.com/foo
go: creating new go.mod: module example.com/foo
$ cat go.mod 
module example.com/foo

go 1.12

As you can see, go.mod now includes the line go 1.12 which will break builds for Go 1.11. Here's how building a simple "hello world" with that go.mod file fails when using Go 1.11.6:

$ ./go1.6/bin/go build .
# runtime/internal/sys
compile: version "go1.12" does not match go tool version "go1.11.6"
# unicode/utf8
compile: version "go1.12" does not match go tool version "go1.11.6"
# math/bits
compile: version "go1.12" does not match go tool version "go1.11.6"
# errors
compile: version "go1.12" does not match go tool version "go1.11.6"
# internal/race
compile: version "go1.12" does not match go tool version "go1.11.6"
# sync/atomic
compile: version "go1.12" does not match go tool version "go1.11.6"
# internal/cpu
compile: version "go1.12" does not match go tool version "go1.11.6"
# unicode
compile: version "go1.12" does not match go tool version "go1.11.6"
# runtime/internal/atomic
compile: version "go1.12" does not match go tool version "go1.11.6"

There are only three options for users impacted by this:

  1. Pin to an older version of whatever module they depend on that doesn't require a version of Go higher than their deploy target
  2. Open a PR against the module to lower the required Go version
  3. Migrate to Go 1.12 on App Engine or GCF, neither of which are available yet (but should be soon)

@bradfitz
Copy link
Contributor

@sbuss, that's not accurate.

A module declared with "go 1.12" should still try to optimistically build with Go 1.11.x.

This was a bug that was fixed in Go 1.11.4. See https://tip.golang.org/doc/go1.12#modules

App Engine is using a version of Go 1.11.x predating Go 1.11.4.

@sbuss
Copy link

sbuss commented Mar 22, 2019

App Engine is using a version of Go 1.11.x predating Go 1.11.4.

App Engine is using Go 1.11.5 since March 6.

@sbuss
Copy link

sbuss commented Mar 22, 2019

@sbuss, that's not accurate.

You're right, I miconfigured the non-default 1.11.6 installation by not setting GOROOT. Setting it makes it work fine.

I can't replicate any errors on App Engine. Depending on cloud.google.com/go@v0.37.1 works fine.

@bradfitz
Copy link
Contributor

That's not what @broady implied 3 days ago in the comments above, and is not implied by the error messages users were reporting in this thread, all within the past 3 days.

loivis pushed a commit to loivis/pavium-api that referenced this issue Mar 23, 2019
latest 0.37.1 module required Go 1.12
Go 1.11.4 or later should work fine but cloud functions is on Go 1.11.0 now.

ref: googleapis/google-api-go-client#345
@bashtian
Copy link

Here the current versions according to runtime.Version:

App Engine: go1.11.5
Cloud Functions: go1.11

It's working on App Engine, but not on Cloud Functions.

@broady
Copy link
Contributor

broady commented Mar 25, 2019

see CL 39231 for fix by @jadekler

@broady broady changed the title Upgrading to go 1.12 broke compatibility with google functions, which only supports 1.11 can't build on go1.11-1.11.3 because of "go 1.12" declaration in go.mod Mar 25, 2019
@tbpg
Copy link
Contributor

tbpg commented Mar 25, 2019

@bradfitz, @sbuss was talking about GAE. This bug was started for GCF (and that's what the earlier comments were about).

@broady
Copy link
Contributor

broady commented Mar 25, 2019

Lots of confusion here. Just to be super clear:

GAE: currently on 1.11.5
GCF: currently on 1.11.0, soon 1.11.5 or 1.11.6

This module: soon to remove "go 1.12" line from go.mod (see CL 39231)

Other modules: hopefully the same.

GCF users: until the builder is updated to 1.11.5+ (soon), pin yourself to v0.37 of cloud.google.com/go, and/or v0.1.0 of google.golang.org/api.

@muratsplat
Copy link

@broady Thank for clarify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

No branches or pull requests

10 participants