Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: unexpected dependencies are added #30206

Closed
mwf opened this issue Feb 13, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@mwf
Copy link

commented Feb 13, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12rc1 darwin/amd64

Does this issue reproduce with the latest release?

Yes, it's reproduced both in go1.11.5 and latest go1.12rc1

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ikorolev/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ikorolev/.gvm/pkgsets/go1.12rc1/global"
GOPROXY=""
GORACE=""
GOROOT="/Users/ikorolev/.gvm/gos/go1.12rc1"
GOTMPDIR=""
GOTOOLDIR="/Users/ikorolev/.gvm/gos/go1.12rc1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/var/folders/_b/d1934m9s587_8t_6ngv3hnc00000gp/T/tmp.8KAivHiQ/radix/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_b/d1934m9s587_8t_6ngv3hnc00000gp/T/go-build143042786=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

cd `mktemp -d`
git clone git@github.com:mediocregopher/radix.git
cd radix
go mod tidy

What did you expect to see?

I expect no significant modifications in go.mod and go.sum

What did you see instead?

go.mod diff:

diff --git a/go.mod b/go.mod
index bca20e2..e6f9944 100644
--- a/go.mod
+++ b/go.mod
@@ -2,10 +2,12 @@ module github.com/mediocregopher/radix/v3

 require (
        github.com/davecgh/go-spew v1.1.1 // indirect
+       github.com/garyburd/redigo v1.6.0 // indirect
        github.com/gomodule/redigo v2.0.0+incompatible
        github.com/joomcode/errorx v0.1.0 // indirect
-       github.com/joomcode/redispipe v0.9.0 // indirect
+       github.com/joomcode/redispipe v0.9.0
        github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed
+       github.com/mediocregopher/radix.v2 v0.0.0-20181115013041-b67df6e626f9 // indirect
        github.com/pmezard/go-difflib v1.0.0 // indirect
        github.com/stretchr/testify v1.2.2
 )

I can't understand the reason why github.com/garyburd/redigo and github.com/mediocregopher/radix.v2 appear in go.mod

go mod why reasonably tells me (main module does not need package <...>).

If they are not used anywhere, how could the appear in the dependency graph?

@mwf mwf changed the title modules: unexpected dependencies are added cmd/go: unexpected dependencies are added Feb 13, 2019

@mwf

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

@gopherbot please add label modules

@gopherbot gopherbot added the modules label Feb 13, 2019

@mwf

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

Sorry, I've finally found it out!

This is because of a benchmark https://github.com/joomcode/redispipe/blob/65d5c697f768952a88c6fc7871ab8d23f553b14e/redisconn/bench_test.go, comparing itself with github.com/garyburd/redigo and github.com/mediocregopher/radix.v2.

Facepalm.

It would be nice, if go mod why could help me in such case.

@mwf

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

It seems go mod why enhancement should be done in #27900, so closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.