我收到此错误:未定义:gomock.AssignableToTypeOf 使用包 github.com/golang/mock 的函数 gomock.AssignableToTypeOf 时发生“
当我在 Project 的 WORKSPACE 文件中更新版本时开始发生这种情况,并且执行bazel coverage
命令时出现的错误未定义:gomock.AssignableToTypeOf
Bazel 版本:4.2.1 Bazel 规则版本:v0.30.0 bazel_gazelle 版本:v0。 24.0 Go 版本:1.17.6 Docker 规则版本:0.23.0
它在以前的版本上运行良好—— Bazel 版本:3.7.1 Bazel 规则版本:v0.27.0 bazel_gazelle 版本:v0.23.0 Go 版本:1.16 Docker 规则版本:0.14.4
这是 WORKSPACE 文件的代码片段。
# Fetch Golang mock
go_repository(
name = "com_github_golang_mock",
# commit = "aba2ff9a6844d5e3289e8472d3217d5b3090f083",
tag = "v1.6.0",
importpath = "github.com/golang/mock",
)
go_repository(
name = "go_googleapis",
# commit = "aba2ff9a6844d5e3289e8472d3217d5b3090f083",
tag = "v0.69.0",
importpath = "github.com/googleapis/google-api-go-client",
)
go_repository(
name = "org_golang_google_genproto",
tag = "v0.0.0-20220216160803-4663080d8bc8",
importpath = "google.golang.org/genproto",
)
go_repository(
name = "org_golang_x_mod",
importpath = "golang.org/x/mod",
tag = "v0.5.1",
)
go_repository(
name = "org_golang_x_xerrors",
importpath = "golang.org/x/xerrors",
sum = "h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=",
version = "v0.0.0-20191011141410-1b5146add898",
)
go_repository(
name = "com_github_jmhodges_bazel_gomock",
tag = "v1.3",
importpath = "github.com/jmhodges/bazel_gomock",
)