Module declared as X but was required as Y

房东的猫 提交于 2020-05-15 06:13:25

问题


I'm trying to use grafana/grafana/pkg/tsdb package in my module. I don't think this problem is specific to grafana but here it goes:

$ go get -u github.com/grafana/grafana/pkg/tsdb
go: finding github.com/inconshreveable/log15 latest
go: finding github.com/go-macaron/session latest
go: finding golang.org/x/oauth2 latest
go: finding github.com/teris-io/shortid latest
go: github.com/grafana/grafana/pkg/tsdb imports
        github.com/go-xorm/core: github.com/go-xorm/core@v0.6.3: parsing go.mod:
        module declares its path as: xorm.io/core
                but was required as: github.com/go-xorm/core

It says that the package tsdb is importing xorm as github.com/go-xorm/core, but the module declares itself as xorm.io/core.

Looking at Grafana's go.mod file, it's using github.com/go-xorm/core and going to github.com/go-xorm/core, it says the project is now archived... and it's go.mod file indeed declared itself as xorm.io/core...

and suggestions on how I can resolve this issue?


回答1:


edit: I also had luck just using a slightly older version:

go get github.com/grafana/grafana/pkg/tsdb@6.6.1

I tried a replace, which can work sometimes:

module foo

replace github.com/go-xorm/core => xorm.io/core v0.6.2

go 1.13

require (
...

but I get a type error.

Luckily it looks like there is a PR out to fix this issue: https://github.com/grafana/grafana/pull/22376



来源:https://stackoverflow.com/questions/60341591/module-declared-as-x-but-was-required-as-y

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!