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: incorrect version of transitive dependencies downloaded by module-aware go-get #28795

Closed
mewmew opened this issue Nov 14, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mewmew
Copy link
Contributor

commented Nov 14, 2018

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

[u@x1 cfa]$ go version
go version devel +0a72e8eefb Wed Nov 14 14:45:03 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
[u@x1 cfa]$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/u/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/u/goget:/home/u/Desktop/go"
GOPROXY=""
GORACE=""
GOROOT="/home/u/go1.11"
GOTMPDIR=""
GOTOOLDIR="/home/u/go1.11/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/cfa/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build590699671=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I tried to compile the packages of the cfa repository which depend on the llir/llvm module at version v0.3.0-pre1. Doing so, resulted in a compile time error, as the incorrect version of the llir/ll dependency of llir/llvm was downloaded, even though it was specified in the go.mod file of v0.3.0-pre1 of llir/llvm:

From llir/llvm@v0.3.0-pre1/go.mod:

	github.com/llir/ll v0.0.0-20181112013344-5eef2118d0e0

From mewmew/cfa/go.mod:

	github.com/llir/llvm v0.3.0-pre1

An extract of the error output reveals that the version of llir/ll downloaded by the module-aware go get does not contain a definition of ast.AliasDef. However, rev llir/ll@5eef211 of llir/ll contains a definition of ast.AliasDef, so we may conclude that the incorrect version was downloaded.

Error message from go get

# github.com/llir/llvm/asm
/home/u/goget/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:65:8: undefined: ast.AliasDef

From https://github.com/llir/ll/blob/5eef2118d0e091289d0d5f8d69816185550acdf3/ast/ast.go#L1670:

type AliasDef struct {

To reproduce, run the following set of commands:

export GO111MODULE=on
git clone https://github.com/mewmew/cfa.git
cd cfa
go get -v ./...

The output of which is as follows, and contains the compile time error mentioned above.

go get -v ./... Output
[u@x1 cfa]$ go get -v ./...
Fetching https://gonum.org/v1/gonum?go-get=1
go: finding github.com/mewkiz/pkg v0.0.0-20181108225906-b4dee0c4e703
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/graphism/exp v0.0.0-20181114155108-95804a9f182b
go: finding github.com/llir/llvm v0.3.0-pre1
Parsing meta tags from https://gonum.org/v1/gonum?go-get=1 (status code 404)
get "gonum.org/v1/gonum": found meta tag get.metaImport{Prefix:"gonum.org/v1/gonum", VCS:"git", RepoRoot:"https://github.com/gonum/gonum"} at https://gonum.org/v1/gonum?go-get=1
go: finding gonum.org/v1/gonum v0.0.0-20181112092319-eb6a40d81aaf
Fetching https://golang.org/x/exp?go-get=1
Fetching https://golang.org/x/tools?go-get=1
go: finding github.com/graphism/simple v0.0.0-20181114131118-4c2595ff451f
go: finding github.com/llir/ll v0.0.0-20181113011500-98d5284f035c
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/kr/pty v1.1.3
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
get "golang.org/x/tools": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/exp?go-get=1 (status code 200)
get "golang.org/x/exp": found meta tag get.metaImport{Prefix:"golang.org/x/exp", VCS:"git", RepoRoot:"https://go.googlesource.com/exp"} at https://golang.org/x/exp?go-get=1
go: finding golang.org/x/tools v0.0.0-20181111003725-6d71ab8aade0
go: finding golang.org/x/tools v0.0.0-20181114145209-99072bc9d7ad
go: finding github.com/mewspring/tools v0.0.0-20181107085742-4dbfa080ff87
go: finding golang.org/x/exp v0.0.0-20181112044915-a3060d491354
go: finding bitbucket.org/zombiezen/cardcpx v0.0.0-20150417151802-902f68ff43ef
go: finding github.com/mewmew/floats v0.0.0-20181110005823-891ed2b7ecb0
go: finding github.com/inspirer/textmapper v0.0.0-20181111212404-973a0cda8bfa
go: finding github.com/llir/ll v0.0.0-20181112013344-5eef2118d0e0
go: finding github.com/kr/text v0.1.0
go: finding golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b
go: finding github.com/kr/pty v1.1.1
go: finding github.com/inspirer/textmapper v0.0.0-20181104204410-4bdb1fb0392a
go: finding github.com/sergi/go-diff v1.0.0
go: finding golang.org/x/exp v0.0.0-20180321215751-8460e604b9de
go: downloading github.com/graphism/exp v0.0.0-20181114155108-95804a9f182b
go: downloading github.com/mewkiz/pkg v0.0.0-20181108225906-b4dee0c4e703
go: downloading gonum.org/v1/gonum v0.0.0-20181112092319-eb6a40d81aaf
go: downloading github.com/llir/llvm v0.3.0-pre1
go: downloading github.com/pkg/errors v0.8.0
go: downloading bitbucket.org/zombiezen/cardcpx v0.0.0-20150417151802-902f68ff43ef
go: downloading github.com/graphism/simple v0.0.0-20181114131118-4c2595ff451f
go: downloading github.com/llir/ll v0.0.0-20181113011500-98d5284f035c
go: downloading github.com/mewmew/floats v0.0.0-20181110005823-891ed2b7ecb0
go: downloading golang.org/x/exp v0.0.0-20181112044915-a3060d491354
gonum.org/v1/gonum/graph
gonum.org/v1/gonum/blas
gonum.org/v1/gonum/internal/asm/c128
bitbucket.org/zombiezen/cardcpx/natsort
gonum.org/v1/gonum/internal/asm/f32
github.com/graphism/simple/internal/ordered
github.com/graphism/simple/internal/set
gonum.org/v1/gonum/graph/iterator
github.com/graphism/simple/internal/uid
gonum.org/v1/gonum/internal/asm/f64
gonum.org/v1/gonum/internal/math32
gonum.org/v1/gonum/lapack
github.com/llir/llvm/internal/enc
github.com/llir/llvm/ir/enum
github.com/mewmew/floats/binary16
github.com/llir/llvm/ir/types
github.com/mewmew/floats/float80x86
github.com/pkg/errors
github.com/llir/llvm/ir/value
github.com/llir/llvm/ir/metadata
github.com/mewkiz/pkg/term
github.com/llir/llvm/ir/constant
gonum.org/v1/gonum/graph/encoding
gonum.org/v1/gonum/graph/formats/dot/ast
gonum.org/v1/gonum/graph/formats/dot/internal/token
gonum.org/v1/gonum/blas/gonum
gonum.org/v1/gonum/floats
gonum.org/v1/gonum/graph/formats/dot/internal/lexer
gonum.org/v1/gonum/graph/formats/dot/internal/astx
github.com/llir/llvm/ir
gonum.org/v1/gonum/graph/formats/dot/internal/errors
gonum.org/v1/gonum/graph/internal/ordered
gonum.org/v1/gonum/graph/formats/dot/internal/parser
gonum.org/v1/gonum/graph/internal/set
github.com/llir/ll
gonum.org/v1/gonum/graph/formats/dot
gonum.org/v1/gonum/graph/encoding/dot
github.com/llir/llvm/asm/enum
github.com/mewkiz/pkg/osutil
github.com/mewkiz/pkg/pathutil
golang.org/x/exp/rand
gonum.org/v1/gonum/graph/internal/uid
gonum.org/v1/gonum/graph/internal/linear
gonum.org/v1/gonum/graph/traverse
gonum.org/v1/gonum/blas/blas64
gonum.org/v1/gonum/lapack/gonum
github.com/llir/ll/selector
github.com/llir/ll/ast
gonum.org/v1/gonum/lapack/lapack64
gonum.org/v1/gonum/mat
github.com/graphism/simple
gonum.org/v1/gonum/graph/simple
github.com/graphism/exp/cfg
gonum.org/v1/gonum/graph/path
github.com/mewmew/cfa/primitive
github.com/mewmew/cfa/interval
github.com/mewmew/cfa/cmd/restructure_interval
github.com/llir/llvm/asm
# github.com/llir/llvm/asm
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:65:8: undefined: ast.AliasDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:68:37: old.ContentType undefined (type ast.LlvmNode has no field or method ContentType)
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:74:8: undefined: ast.IFuncDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:77:37: old.ContentType undefined (type ast.LlvmNode has no field or method ContentType)
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:145:9: undefined: ast.AliasDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:153:9: undefined: ast.IFuncDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:331:61: undefined: ast.AliasDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/global.go:373:61: undefined: ast.IFuncDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/helper.go:332:43: oldFlag.Text undefined (type ast.DIFlag has no field or method Text)
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/module.go:71:9: undefined: ast.AliasDef
/tmp/gofoo/pkg/mod/github.com/llir/llvm@v0.3.0-pre1/asm/module.go:71:9: too many errors

What did you expect to see?

Successful compilation.

What did you see instead?

The compile error detailed above.

@bcmills

This comment has been minimized.

Copy link
Member

commented Nov 14, 2018

This seems to be working as designed. The dependency via github.com/llir/llvm is as you say, but you also have a higher requirement via github.com/graphism/exp.

In general, you should be able to use go mod graph to diagnose these sorts of issues:

cfa$ go mod graph | grep 'llir/ll@'
github.com/llir/llvm@v0.3.0-pre1 github.com/llir/ll@v0.0.0-20181112013344-5eef2118d0e0
github.com/llir/ll@v0.0.0-20181112013344-5eef2118d0e0 github.com/inspirer/textmapper@v0.0.0-20181104204410-4bdb1fb0392a
github.com/graphism/exp@v0.0.0-20181114155108-95804a9f182b github.com/llir/ll@v0.0.0-20181113011500-98d5284f035c
github.com/llir/ll@v0.0.0-20181113011500-98d5284f035c github.com/inspirer/textmapper@v0.0.0-20181104204410-4bdb1fb0392a

cfa$ go mod why -m github.com/graphism/exp
# github.com/graphism/exp
github.com/mewmew/cfa/cmd/ll2go_interval
github.com/graphism/exp/cfg

Perhaps we should also have a go mod why mode to query “why this version?” rather than just “why this [package / module]?”. I'll file that separately.

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.