Giter VIP home page Giter VIP logo

Comments (16)

nejisama avatar nejisama commented on August 16, 2024

mosn.io/pkg/log中也没有依赖consul 这个库啊?用这个库的看了下是dubbogo的间接依赖,只要引用这部分,直接用你项目里需要的版本就可以了吧?我理解应该没有冲突的?

from holmes.

nejisama avatar nejisama commented on August 16, 2024

只要你的项目里不依赖 github.com/dubbogo/gost 应该就可以用你需要的版本了吧?

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024
会报这个错,是mod,会报错,不知道找哪个版本,即使我指定自己用的consul 包是1.4.3。另一个consul/[email protected],是mosn.io/pkg/log中的库,在go.sum中能找到 https://github.com/mosn/holmes/blob/master/go.sum#L199

consul_registry.go:7:2: ambiguous import: found package github.com/hashicorp/consul/api in multiple modules:
	github.com/hashicorp/consul v1.4.3 (/root/go/pkg/mod/github.com/hashicorp/[email protected]/api)
	github.com/hashicorp/consul/api v1.3.0 (/root/go/pkg/mod/github.com/hashicorp/consul/[email protected])

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

只要你的项目里不依赖 github.com/dubbogo/gost 应该就可以用你需要的版本了吧?

项目里面没有依赖gost,我理解是mosn.io/pkg里面附带的包,有用到gost的包(https://github.com/mosn/holmes/blob/master/go.sum#L85)

consul/api的间接引用sum位置:
https://github.com/mosn/holmes/blob/master/go.sum#L199

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

log是没有依赖,但是log所在的pkg包中包含了.

这个里面包含了 mosn.io/pkg v0.0.0-20211217101631-d914102d1baf

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

我的理解是 :

mosn.io/holmes 中用到了 log,其中的log来源是mosn.io/pkg v0.0.0-20211217101631-d914102d1baf。

这个pkg中有其他的包,并没有被holmes所用(holmes只用到了其中的log),比如dubbogo,但是在pkg里面,依然会被加载,从而间接加载进holmes。

所以导致了consul/api的版本冲突。

from holmes.

nejisama avatar nejisama commented on August 16, 2024
module mosn.io/test

go 1.14

require (
	github.com/hashicorp/consul/api v1.12.0
	mosn.io/pkg v1.0.0
)

我自己简单写了一个demo 指定的是更新的版本,因为我只用了pkg/log 并没有用pkg下的dubbo 所以没有报冲突

from holmes.

nejisama avatar nejisama commented on August 16, 2024

go.sum里的内容可能有很多,但是并不会影响实际的使用才对

from holmes.

nejisama avatar nejisama commented on August 16, 2024

我指定了一下低版本(v1.4.3) 是有问题,我看了下 是因为他这个低版本还没有按照规范接入go.mod导致的

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

https://github.com/baipangbai/selfmotion

image

确实1.4.3会有问题,所以建议是升级还是可以把pkg中的相关依赖给去掉呢

from holmes.

nejisama avatar nejisama commented on August 16, 2024

在低版本 github.com/hashicorp/consul 是一个库,对应的github.com/hashicorp/consul/api 是包含在里面的
但是 新版本下 github.com/hashicorp/consul/api 是一个独立的版本,所以这里识别上会有冲突

from holmes.

nejisama avatar nejisama commented on August 16, 2024

https://github.com/baipangbai/selfmotion

image

确实1.4.3会有问题,所以建议是升级还是可以把pkg中的相关依赖给去掉呢

pkg里的registry/dubbo是有使用的,不可能去掉

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

github.com/hashicorp/consul 是一个库,对应的github.com/hashicorp/consul/api 是包含在里面的
但是 新版本下 github.com/hashicorp/consul/api 是一个独立的版本,所以这里识别上会有冲突

明白了,感谢回答~♥️

from holmes.

nejisama avatar nejisama commented on August 16, 2024

github.com/hashicorp/consul 是一个库,对应的github.com/hashicorp/consul/api 是包含在里面的
但是 新版本下 github.com/hashicorp/consul/api 是一个独立的版本,所以这里识别上会有冲突

明白了,感谢回答~♥️

我看了下 https://github.com/hashicorp/consul/tree/api/v1.3.0/api 这个库专门为1.3.0 的api加了一个go.mod 但是1.4.3 这个没有。。所以导致这里识别冲突了

from holmes.

baipangbai avatar baipangbai commented on August 16, 2024

如果有底层依赖consul 导致冲突,且底层涉及较多,不方便都升级解决方案~

replace github.com/hashicorp/consul => github.com/hashicorp/consul v1.5.0 (hashicorp/consul#6019
)

from holmes.

nejisama avatar nejisama commented on August 16, 2024

如果有底层依赖consul 导致冲突,且底层涉及较多,不方便都升级解决方案~

replace github.com/hashicorp/consul => github.com/hashicorp/consul v1.5.0 (hashicorp/consul#6019 )

这里我想了一下,可以考虑把pkg里的部分内容 单独组织一个go.mod 可能可以一定程度避免这种问题,但是不能彻底的解决。

from holmes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.