Google Cloud BigQuery 未定义的 ValueList

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

Google cloud BigQuery undefined ValueList

问题

我正在使用Google Cloud Platform上的BigQuery API,并且已经完成了Golang客户端库的安装。

当我尝试编译时,我看到以下错误:

[root@server ~]$ go install github.com/user/program

github.com/user/program/handler

go/src/github.com/user/program/handler/file1.go:228: undefined:
"cloud.google.com/go/bigquery".ValueList
go/src/github.com/user/program/handler/file1.go:259: undefined:
"cloud.google.com/go/bigquery".ValueList

第228行的问题出在这里:

227 for {
228 var values bigquery.ValueList
229 err := it.Next(&values)

在文件的顶部,我按照通常的方式导入了该包:

import "cloud.google.com/go/bigquery"

并且已经注意安装了Golang的客户端库
https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-go

我可以看到cloud.google.com包包含在我的GOPATH中,并且我在其中的一个文件中看到了ValueList类型的声明。因此,我对这个错误感到困惑。

更重要的是:我可以在我的Windows机器上成功编译,没有错误。只有当我尝试在我的CentOS虚拟机上做同样的事情时,才会遇到这个问题。两者都运行go版本go1.6.3。

谢谢。

英文:

I'm working with the BigQuery API on Google Cloud Platform and I've completed the Golang client library installation.

When I try to compile, I see the following errors:

[root@server ~]$ go install github.com/user/program
# github.com/user/program/handler
go/src/github.com/user/program/handler/file1.go:228: undefined:
"cloud.google.com/go/bigquery".ValueList
go/src/github.com/user/program/handler/file1.go:259: undefined: 
"cloud.google.com/go/bigquery".ValueList

The offending line for 228 is:

227 for {
228     var values bigquery.ValueList
229     err := it.Next(&values)

At the top of the file I import the package, as normally

import "cloud.google.com/go/bigquery"

and have taken care to install the client library for Golang
https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-go

I can see that the cloud.google.com package is contained within my GOPATH and I see the ValueList type decleration inside of a file in there. It is therefore puzzling that I'm getting this error.

What's more: I can compile this fine on my Windows machine with no errors. It's only when I try to do the same thing on my CentOS VM that I run into this. Both are running go version go1.6.3.

Thank you.

答案1

得分: 0

@Spikey,

嗨,请确保你已经安装了正确的客户端。以下是原因:

  1. 在安装了go get -u cloud.google.com/go/bigquery之后,我发现它们没有导出ValueList类型(!)。只有valuelist,即非导出类型。请检查~go/src/google.golang.org/cloud/bigquery/value.go的第39行。

  2. 然而,他们在文档中提到了ValueList作为一个导出类型(!),例如:

  • ~go/src/google.golang.org/cloud/bigquery/doc.go的第52行
  • https://godoc.org/cloud.google.com/go/bigquery
  • ~go/src/google.golang.org/cloud/README.md的第164行
  1. 此外,如果直接查看https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/bigquery/value.goValueList是一个导出类型。

因此,关于安装正确的Google客户端存在一些混淆。

希望对你有所帮助!

英文:

@Spikey,

Hi, please make sure you've installed correct client.
Here's why:

  1. After installing go get -u cloud.google.com/go/bigquery I see that they do not have an exported ValueList type(!). Only valuelist, i.e. unexported. Check line 39 of ~go/src/google.golang.org/cloud/bigquery/value.go

  2. However, they do mention ValueList as an exported type in their docs(!), for example:

  1. Also, ValueList is an exported type if looking directly at: https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/bigquery/value.go

So there's a confusion about installing a correct Google client.

Hope this helps!

huangapple
  • 本文由 发表于 2016年12月2日 00:08:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/40915315.html
匿名

发表评论

匿名网友

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

确定