go
module_error
ai_generated
true
no required module provides package github.com/foo/bar; to add it: go get github.com/foo/bar
ID: go/cannot-find-module-providing-package
80%Fix Rate
90%Confidence
0Evidence
2024-01-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.16+ | active | — | — | — |
| 1.21+ | active | — | — | — |
Root Cause
The import is used in source but go.mod has no require entry for the providing module, and -mod=readonly prevents auto-adding.
generic中文
源码中使用了该导入,但 go.mod 中没有提供该模块的 require 条目,且 -mod=readonly 阻止自动添加。
Workarounds
-
95% success
go get github.com/foo/bar@latest go mod tidy
-
90% success
go build -mod=mod ./...
Dead Ends
Common approaches that don't work:
-
70% fail
wrong version causes 'unknown revision' or checksum errors
-
90% fail
build fails with 'vendor directory does not exist'
-
60% fail
loses all existing dependency pins and may break transitive deps