gpt4 book ai didi

go - 我无法导入“cloud.google.com/go/datastore”

转载 作者:行者123 更新时间:2023-12-01 22:17:34 26 4
gpt4 key购买 nike

我不明白为什么这样:/

我用发现的每个URL尝试了go get -u **
谢谢

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

最佳答案

Go要求您使用任何导入的软件包。在这种情况下,您要导入“cloud.google.com/go/datastore”,但不对其进行任何操作。您声明的全局变量也没有被使用。由于似乎您只是在尝试测试,所以我建议您使用它(至少打印出来)。喜欢-

package main

import (
"fmt"

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

var client *datastore.Client

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

关于go - 我无法导入“cloud.google.com/go/datastore”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58565020/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com