prog.go:12:2: missing go.sum entry for module providing package github.com/golang/mock/mockgen/model; to add: go mod download github.com/golang/mock prog.go:12:2: missing go.sum entry for module providing package github.com/golang/mock/mockgen/model; to
时间: 2023-08-11 13:03:16 浏览: 354
It seems like you are encountering a missing go.sum entry error while running a Go program that uses the "github.com/golang/mock/mockgen/model" package. This error occurs when the required package is not present in the go.sum file, which is used to validate the integrity of downloaded dependencies.
You can resolve this error by running the following command in your terminal:
```
go mod download github.com/golang/mock
```
This command will download the required package and update the go.sum file with the corresponding checksum. After that, you should be able to run your program without any issues.
相关问题
mockgen -destination db/mock/store.go github.com/projects/simplebank/db/sqlc Store prog.go:12:2: missing go.sum entry for module providing package github.com/golang/mock/mockgen/model; to add: go mod download github.com/golang/mock prog.go:12:2: missing go.sum entry for module providing package github.com/golang/mock/mockgen/model; to add: go mod download github.com/golang/mock prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules' prog.go:14:2: no required module provides package github.com/projects/simplebank/db/sqlc: go.mod file not found in current directory or any parent directory; see 'go help modules' 2023/06/06 13:53:04 Loading input failed: exit status 1
这个问题看起来是关于使用 mockgen 工具时出现的错误。根据错误提示,似乎缺少了一些模块,需要下载。你可以尝试在终端中运行以下命令来下载缺少的模块:
```
go mod download github.com/golang/mock
```
此外,还有两个文件缺失,分别是 go.mod 和 go.sum 文件。你可以在当前目录或任何父目录中创建这两个文件,或者使用命令来生成它们:
```
go mod init <module-name>
```
替换 <module-name> 为你的模块名称即可。这样,你就可以继续使用 mockgen 工具来生成代码。
mockgen -destination db/mock/store.go github.com/projects/simplebank/db/sqlc Store go: updates to go.mod needed; to update it: go mod tidy go: updates to go.mod needed; to update it: go mod tidy prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules' prog.go:14:2: no required module provides package github.com/projects/simplebank/db/sqlc: go.mod file not found in current directory or any parent directory; see 'go help modules' 2023/06/06 13:42:37 Loading input failed: exit status 1
这似乎是一个错误消息,其中涉及到Go模块和依赖项。您是否需要更新您的Go模块或安装所需的依赖项?这可能会解决这个问题。您可以尝试运行`go mod tidy`来更新您的模块和依赖项,并确保在当前目录或父目录中存在正确的模块文件。如果问题仍然存在,您可以进一步调查`github.com/golang/mock/mockgen/model`和`github.com/projects/simplebank/db/sqlc`包的缺失问题。
阅读全文