英文:
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,
嗨,请确保你已经安装了正确的客户端。以下是原因:
-
在安装了
go get -u cloud.google.com/go/bigquery
之后,我发现它们没有导出ValueList
类型(!)。只有valuelist
,即非导出类型。请检查~go/src/google.golang.org/cloud/bigquery/value.go
的第39行。 -
然而,他们在文档中提到了
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行
- 此外,如果直接查看
https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/bigquery/value.go
,ValueList
是一个导出类型。
因此,关于安装正确的Google客户端存在一些混淆。
希望对你有所帮助!
英文:
@Spikey,
Hi, please make sure you've installed correct client.
Here's why:
-
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
-
However, they do mention ValueList as an exported type in their docs(!), for example:
- line 52 of ~go/src/google.golang.org/cloud/bigquery/doc.go
- https://godoc.org/cloud.google.com/go/bigquery
- line 164 of ~/go/src/google.golang.org/cloud/README.md
- 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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论