简体   繁体   中英

Issue with using a modified version of a Go dependency

So here is the situation:

I have a fork of go-ipfs . It depends on go-ipfs-config . I need to modify go-ipfs-config and make go-ipfs depend on my modified version.

I forked the go-ipfs-config made my changes and made sure to update the path to be that of my forked version as can be seen here . I confirmed that this still builds successfully by running go build

Then I updated go.mod in go-ipfs to use my modified version. I used the replace directive to signify this intention which can be seen here

This is where things gets absolutely bunkers and I am no longer sure what is going on.

When i do go mod tidy to fetch the dependency i get the following output:

go: finding module for package github.com/dadepo/go-ipfs-config
go: found github.com/dadepo/go-ipfs-config in github.com/dadepo/go-ipfs-config v0.5.3

The crazy thing is that v0.5.3 does not exist in github.com/dadepo/go-ipfs-config!

Also the following line get added to go.mod:

github.com/dadepo/go-ipfs-config v0.5.3 // indirect

Which can even be seen here

I have run commands like go clean -modcache and go clean -r etc but does not seem to fix things!

Does anybody know what I am doing wrong? And also how to achieve the goal of making my version of a project depend on another modified version of its dependency?

Ok, so this is as a result of me not being aware of couple of things going on in the Go lang toolchain.

Apparently https://proxy.golang.org is a thing. It is a service operated by google that caches modules, So If you made a release, deleted it, chances are that the version is already cached in https://proxy.golang.org . This was exactly what happened in my case. I had made a 0.5.3 release, deleted it, but it is not really gone as the Google cache already got a hold of it.

So in case you are seeing versions that should not exist. This should be the first place you check. This documentation link also sheds some more light on the proxy and how it can be tweaked.

I found this out based on the conversation I had on the issue I opened reporting this behaviour. If you are curious, you can check it out here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM