moby / libnetwork

networking for containers
Apache License 2.0
2.16k stars 881 forks source link

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

Closed rajusah15 closed 1 month ago

rajusah15 commented 2 years ago

getting following error:

go get: github.com/Sirupsen/logrus@none updating to github.com/Sirupsen/logrus@v1.8.1: 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/check@v0.0.0-20201130134442-10cb98267c6c: 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

pcolladosoto commented 2 years ago

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/libnetwork@v0.5.6 \
    -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/libnetwork@v0.5.6

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!

thediveo commented 2 years ago

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 commented 2 years ago

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...?

akerouanton commented 1 month ago

Thanks for reporting!

This repo is now defunct (code has moved to https://github.com/moby/moby/tree/master/libnetwork), and is not actively watched by maintainers. So let me close this issue.