我不明白为什么这样:/
我尝试使用go get -u **
找到的每个URL。
谢谢
Golang:
$ go version
go version go1.13.3 windows/amd64
源测试:
package main
import (
"fmt"
"cloud.google.com/go/datastore"
)
var client *datastore.Client
func main() {
fmt.Println("Work")
}
错误:
$ go run main.go
# google.golang.org/grpc/internal/transport
..\..\..\..\google.golang.org\grpc\internal\transport\http_util.go:270:23: cannot use hf (type "vendor/golang.org/x/net/http2/hpack".HeaderField) as type
"golang.org/x/net/http2/hpack".HeaderField in argument to d.processHeaderField
..\..\..\..\google.golang.org\grpc\internal\transport\http_util.go:675:23: cannot use "golang.org/x/net/http2/hpack".NewDecoder(http2InitHeaderTableSize,
nil) (type *"golang.org/x/net/http2/hpack".Decoder) as type *"vendor/golang.org/x/net/http2/hpack".Decoder in assignment
答案 0 :(得分:1)
Go要求您使用任何导入的软件包。在这种情况下,您要导入“ cloud.google.com/go/datastore”,但不对其进行任何操作。您声明的全局变量也没有被使用。既然您似乎只是在尝试测试,所以我建议您使用它(至少打印出来)。喜欢-
package main
import (
"fmt"
"cloud.google.com/go/datastore"
)
var client *datastore.Client
func main() {
fmt.Println(client)
}