libnetwork icon indicating copy to clipboard operation
libnetwork copied to clipboard

Libnetwork is failing while executing command ' get github.com/moby/libnetwork'

Open rajusah15 opened this issue 3 years ago • 3 comments

getting following error:

go get: github.com/Sirupsen/logrus@none updating to github.com/Sirupsen/[email protected]: parsing go.mod: module declares its path as: github.com/sirupsen/logrus but was required as: github.com/Sirupsen/logrus

After manually changing from 'sirupsen' to 'Sirupsen' it started giving another error: github.com/docker/docker/pkg/discovery.test imports github.com/go-check/check: github.com/go-check/[email protected]: parsing go.mod: module declares its path as: gopkg.in/check.v1 but was required as: github.com/go-check/check

pls let me know what dependency is required or any change in config. file

rajusah15 avatar Mar 03 '22 12:03 rajusah15

Hi! I also encountered this issue but I was lucky enough to solve it with sed(1) and find(1):

sudo find $GOPATH/pkg/mod/github.com/docker/[email protected] \
    -type file -name "*.go" -exec sed -i -e 's/Sirupsen/sirupsen/g' {} \;

This basically swaps Sirupsen by sirupsen on every file. Note we use sudo because permissions within $GOPATH are 0444 (i.e. readonly), which means we can not edit the files as a 'normal' user. You can also try to chown +w /path/to/file each of them if that's your jam!

I did find that the import statement was trying to include log "github.com/Sirupsen/logrus" with:

grep -R Sirupsen $GOPATH/pkg/mod/github.com/docker/[email protected]

As go points out, the module's go.mod does use the path with sirupsen instead of Sirupsen.

If this is a mistake on our end I would be delighted to know: that way I won't run into the issue again!

I would be happy to submit a PR with the changes in case that's something you'd appreciate.

Thanks for your time!

pcolladosoto avatar Jul 19 '22 11:07 pcolladosoto

UPDATED!

Trying to sed around this is a no-go (sic) for CI/CD.

This is a real mess. I somehow seems to get along now with this replace in my go.mod, so that not only a go mod tidy then works, but also a build:

replace github.com/docker/libnetwork => github.com/docker/libnetwork v0.8.0-dev.2.0.20220716072657-0dde5c895075

This replace is based on the vendoring of github.com/moby/moby for v20.10.20.

thediveo avatar Oct 22 '22 20:10 thediveo

Please see my update above, as the replaces worked for go mod tidy but I only later hit build errors. After diving into the vendoring of @moby/moby I could build a plugin binary using the specific replace for github.com/docker/libnetwork.

Did I mention that this is messy...?

thediveo avatar Oct 25 '22 16:10 thediveo