我不明白该错误意味着什么,但我认为绝对路径中的包和供应商路径中的包之间很混乱。怎样才能让它不混淆呢?
# github.com/GoogleCloudPlatform/terraformer/providers/alicloud
providers/alicloud/dum.go:10:35: cannot use func literal (type func(*"github.com/aliyun/aliyun-oss-go-sdk/oss".Client) (interface {}, error)) as type func(*"github.com/terraform-providers/terraform-provider-alicloud/vendor/github.com/aliyun/aliyun-oss-go-sdk/oss".Client) (interface {}, error) in argument to client.WithOssClient
这是最小的可重现代码
package dum
import (
oss "github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/terraform-providers/terraform-provider-alicloud/alicloud/connectivity"
)
func dum() error {
client := connectivity.AliyunClient{}
raw, err := client.WithOssClient(func(ossClient *oss.Client) (interface{}, error) {
return ossClient.ListBuckets()
})
if err != nil {
return err
}
println(raw)
return nil
}
编辑:解决方案
go mod vendor
go build -v
偶然的你
翻阅古今
相关分类