我无法导入 "cloud.google.com/go/datastore"

I can't import "cloud.google.com/go/datastore"

我不明白为什么会这样:/

我尝试 go get -u ** 我找到的每个 url。 谢谢

戈朗:

$ 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

Go 要求您使用您导入的任何包。在这种情况下,您正在导入 "cloud.google.com/go/datastore" 但不对其进行任何操作。您声明的全局变量也没有被使用。因为看起来你只是想测试,所以我建议你用它做点什么(至少打印出来)。赞-

package main

import (
    "fmt"

    "cloud.google.com/go/datastore"
)

var client *datastore.Client

func main() {
    fmt.Println(client)
}