gcpug / nouhau

Google Cloud Platformのノウハウを共有するRepository
https://gcpug.jp
MIT License
655 stars 23 forks source link

cloud.google.com/go/spanner v0.18.0 はBuildが通らない #30

Closed sinmetal closed 6 years ago

sinmetal commented 6 years ago

問題

https://github.com/GoogleCloudPlatform/google-cloud-go のspannerをv0.18.0で利用しようとすると、Buildが通らない

vendor/cloud.google.com/go/spanner/go18.go:36:2: too many arguments to return
    have ("context".Context, *"github.com/sinmetal/gcp_playground/vendor/go.opencensus.io/trace".Span)
    want ("context".Context)
vendor/cloud.google.com/go/spanner/go18.go:44:2: undefined: "github.com/sinmetal/gcp_playground/vendor/go.opencensus.io/trace".EndSpan

原因

v0.18.0 で入った Added OpenCensus support. で利用している https://github.com/census-instrumentation/opencensus-go のversionが噛み合わなくてBuildが通らない

該当箇所

https://github.com/GoogleCloudPlatform/google-cloud-go/blob/06da8ec9c2e2f6e11a89d644bbedf2e3e040bcd7/spanner/go18.go#L36go.opencensus.io/trace.StartSpann の戻り値が2つ返ってくるのがおそらく正しいが、 https://github.com/GoogleCloudPlatform/google-cloud-go/blob/767c40d6a2e058483c25fa193e963a22da17236d/spanner/go18.go#L36 は1つしか受け取ってないので、死ぬ

解決策

v.17.0 を利用するか master を利用する

sinmetal commented 6 years ago

https://github.com/GoogleCloudPlatform/google-cloud-go/tree/v0.19.0 がReleaseされた!