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: build with vendor fails when go.mod doesn't record dependencies #47823

Closed
williamh opened this issue Aug 19, 2021 · 3 comments
Closed
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@williamh
Copy link

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

$ go version
go version go1.17 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
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/william/.cache/go-build"
GOENV="/home/william/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/william/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/william/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build78892724=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ git clone https://github.com/energicryptocurrency/energi3.git
$ cd energi3
$ git checkout v3.0.8
$ go build ./cmd/geth

What did you expect to see?

Successful build of the geth binary

What did you see instead?

$ go build ./cmd/geth
go: updates to go.mod needed, disabled by -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
        to update it:
        go mod tidy

Then, go mod tidy doesn't update anything.

This builds with go 1.16.x, so something changed in 1.17. I don't know if it is a bug in Go or something needs to be changed in the package.

Thanks much for your time.

Cc: @candrews

@seankhliao
Copy link
Member

That go.mod doesn't look right, it doesn't actually list any dependencies.
go mod tidy fails due to incompatible version upgrades because the go.mod doesn't actually record any info about dependencies.

go 1.15

module energi.world/core/gen3

Not sure if this is a supported way of doing things?
cc @jayconrod @bcmills @matloob

@seankhliao seankhliao changed the title strange build failure with go 1.17 cmd/go: build with vendor fails when go.mod doesn't record dependencies Aug 19, 2021
@seankhliao seankhliao added GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 19, 2021
@candrews
Copy link

candrews commented Aug 20, 2021

originally reported at https://bugs.gentoo.org/808829

I've also reached out to the energi3 developers via email at contact@energi.world; the ticket number in energi3's system is 11780

@jayconrod
Copy link
Contributor

I think this is working correctly. 1.16 should have reported an error. vendor/modules.txt must be consistent with go.mod, and here, the requirements aren't listed in go.mod at all.

go mod tidy can generally fix problems like this, but here, it reports an error:

energi.world/core/gen3/cmd/geth imports
        github.com/gizak/termui: module github.com/gizak/termui@latest found (v3.1.0+incompatible), but does not contain package github.com/gizak/termui
energi.world/core/gen3/internal/build imports
        github.com/Azure/azure-storage-blob-go/2018-03-28/azblob: module github.com/Azure/azure-storage-blob-go@latest found (v0.14.0), but does not contain package github.com/Azure/azure-storage-blob-go/2018-03-28/azblob
energi.world/core/gen3/node imports
        github.com/prometheus/prometheus/util/flock: module github.com/prometheus/prometheus@latest found (v2.5.0+incompatible), but does not contain package github.com/prometheus/prometheus/util/flock

Since there aren't any pre-existing requirements, go mod tidy will look up the latest version of each module to try to satisfy imports. From the errors, it sounds like those packages have been deleted upstream.

candrews added a commit to candrews/energi3 that referenced this issue Aug 24, 2021
Provides compatibility with go 1.17
Fixes warnings in earlier versions of go

See golang/go#47823
@golang golang locked and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants