英文:
VSCode/Go telling me to go get a package belonging to a subfolder
问题
Go/VSCode一直告诉我从GitHub获取一个包,但实际上它是我拥有的子文件夹。
我已经将go.mod中的路径替换为私有文件夹路径:
replace (
github.com/brianmaksy/m-highscore v0.0.0 => ./
)
一直弹出的错误信息是:
cli\server\main.go:7:2: 没有必需的模块提供了github.com/brianmaksy/m-highscore/internal包;要添加它:
go get github.com/brianmaksy/m-highscore/internal
如果有人知道可能出错的原因,我将非常感激。提前谢谢。
英文:
Go/VSCode keeps telling me to go get a package from github, when it is a subfolder which I own.
I have already replaced the route in my go.mod to be a private folder path:
replace (
github.com/brianmaksy/m-highscore v0.0.0 => ./
)
The error message that keeps popping up is:
cli\server\main.go:7:2: no required module provides package github.com/brianmaksy/m-highscore/internal; to add it:
go get github.com/brianmaksy/m-highscore/internal
If anyone has an idea of what might be wrong, I'd be very grateful. Thanks in advance.
答案1
得分: 1
我找到了解决方案。问题似乎是因为"internal"是一个空文件夹。当我将导入语句更改为:
internal "github.com/brianmaksy/m-highscore/internal/server"
问题就解决了。
我将保留这个问题,以防将来有人有同样的问题。
英文:
I have found the solution. The problem appears to be that "internal" was an empty folder". As soon as I changed the import to:
internal "github.com/brianmaksy/m-highscore/internal/server"
the problem was gone.
Keeping this question here in case it helps anyone in the future.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论