使用最新的App Engine SDK(golang 1.4.2)与gRPC

huangapple go评论76阅读模式
英文:

Using grpc with latest appengine sdk (golang 1.4.2)

问题

使用最新的AppEngine SDK,其底层是Go版本1.4.2:

由于依赖于http2,go get google.golang.org/grpc 失败,显然与当前的AppEngine SDK版本不兼容。似乎只有从1.6版本开始才支持http2:

> 从Go 1.6及更高版本开始

(参考:https://godoc.org/golang.org/x/net/http2)

调用 go get golang.org/x/net/http2 无法解决错误。

虽然最初在使用Google Cloud Storage时发现了这个问题,但似乎在整个库中都使用了http2:https://github.com/GoogleCloudPlatform/gcloud-golang/search?utf8=%E2%9C%93&q=grpc

英文:

Using latest appengine SDK which is go version 1.4.2 under the hood:

go get google.golang.org/grpc fails due to dependency on http2 which evidently doesn't work with the current appengine sdk release. Seems http2 stuff is only available only from 1.6+:

> from Go 1.6 and later

(ref: https://godoc.org/golang.org/x/net/http2)

calling go get golang.org/x/net/http2 did not fix the errors

While I originally caught this in working with google cloud storage, seems it's used throughout this library: https://github.com/GoogleCloudPlatform/gcloud-golang/search?utf8=%E2%9C%93&q=grpc

答案1

得分: 2

使用以下命令更新http2包:

go get -u golang.org/x/net/http2

根据go命令的描述(https://golang.org/cmd/go/):

-u标志指示get命令使用网络更新指定的包及其依赖项。默认情况下,get命令使用网络来检查缺失的包,但不使用网络来查找现有包的更新。

英文:

update the http2 package using

go get -u golang.org/x/net/http2

from the description of go commands (https://golang.org/cmd/go/):

> The -u flag instructs get to use the network to update the named
> packages and their dependencies. By default, get uses the network to
> check out missing packages but does not use it to look for updates to
> existing packages.

答案2

得分: 0

这似乎是我的本地配置出了问题:

仅供记录...

davidk-osx:Desktop davidk$ more ~/.bash_profile

> export GOROOT=/usr/local/go
> export PATH=$PATH:$GOROOT/bin
> export GOPATH=/Users/davidk/Documents/golang
> export PATH=$GOPATH/bin:$PATH

davidk-osx:Desktop davidk$ go version

> go version go1.6 darwin/amd64

davidk-osx:Desktop davidk$ /Applications/go_appengine/goapp version

> go version go1.4.2 (appengine-1.9.33) darwin/amd64

davidk-osx:Desktop davidk$ mkdir ./TEMP_GOPATH
davidk-osx:Desktop davidk$ export GOPATH=/Users/davidk/Desktop/TEMP_GOPATH
davidk-osx:Desktop davidk$ go get google.golang.org/grpc
davidk-osx:Desktop davidk$ go get google.golang.org/cloud/storage

(即一切正常,但是然后...)

davidk-osx:Desktop davidk$ export GOPATH=/Users/davidk/Documents/golang
davidk-osx:Desktop davidk$ go get google.golang.org/grpc

> # google.golang.org/grpc/transport
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_client.go:678: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_client.go:774: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_server.go:140: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_server.go:253: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http_util.go:279: f.fr.ReadMetaHeaders undefined (type *http2.Framer has no field or method ReadMetaHeaders)
> davidk-osx:Desktop davidk$

英文:

This turned out to be an issue with my local configuration somehow:

Just for the record...

davidk-osx:Desktop davidk$ more ~/.bash_profile

> export GOROOT=/usr/local/go
> export PATH=$PATH:$GOROOT/bin
> export GOPATH=/Users/davidk/Documents/golang
> export PATH=$GOPATH/bin:$PATH

davidk-osx:Desktop davidk$ go version

> go version go1.6 darwin/amd64

davidk-osx:Desktop davidk$ /Applications/go_appengine/goapp version

> go version go1.4.2 (appengine-1.9.33) darwin/amd64

davidk-osx:Desktop davidk$ mkdir ./TEMP_GOPATH
davidk-osx:Desktop davidk$ export GOPATH=/Users/davidk/Desktop/TEMP_GOPATH
davidk-osx:Desktop davidk$ go get google.golang.org/grpc
davidk-osx:Desktop davidk$ go get google.golang.org/cloud/storage

(i.e. everything is fine, but then...)

davidk-osx:Desktop davidk$ export GOPATH=/Users/davidk/Documents/golang
davidk-osx:Desktop davidk$ go get google.golang.org/grpc

> # google.golang.org/grpc/transport
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_client.go:678: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_client.go:774: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_server.go:140: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http2_server.go:253: undefined: http2.MetaHeadersFrame
> ../Documents/golang/src/google.golang.org/grpc/transport/http_util.go:279: f.fr.ReadMetaHeaders undefined (type *http2.Framer has no field or method ReadMetaHeaders)
> davidk-osx:Desktop davidk$

huangapple
  • 本文由 发表于 2016年3月4日 02:34:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/35780199.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定