ganto / copr-lxc3

RPM spec files for building lxc-3 on Fedora COPR
MIT License
8 stars 2 forks source link

lxd fails to build on EPEL 7 and Fedora 26 with "t.Helper undefined (type testing.TB has no field or method Helper)" #1

Closed ganto closed 6 years ago

ganto commented 6 years ago

Error happens when building the github.com/CanonicalLtd/raft-test go module:

BUILDSTDERR: github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test
BUILDSTDERR: mkdir -p $WORK/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/_obj/
BUILDSTDERR: cd /builddir/build/BUILD/lxd-3.0.0/_output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test
BUILDSTDERR: /usr/lib/golang/pkg/tool/linux_amd64/compile -o $WORK/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test.a -trimpath $WORK -shared -p github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test -complete -installsuffix shared -buildid 9131365ab51a64889a7a1ca780fa643c604ecc84 -importmap github.com/CanonicalLtd/raft-test/internal/raftext=github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/internal/raftext -importmap github.com/hashicorp/raft=github.com/lxc/lxd/vendor/github.com/hashicorp/raft -importmap github.com/stretchr/testify/require=github.com/lxc/lxd/vendor/github.com/stretchr/testify/require -D _/builddir/build/BUILD/lxd-3.0.0/_output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test -I $WORK -I /builddir/build/BUILD/lxd-3.0.0/_output/pkg/linux_amd64_shared -pack ./cluster.go ./config.go ./control.go ./duration.go ./fsm.go ./fsm_watcher.go ./log.go ./network.go ./node.go ./notify.go ./scenarios.go ./servers.go ./transport.go
BUILDSTDERR: # github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:50: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:120: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:169: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:226: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:285: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/cluster.go:313: t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/control.go:39: c.t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/control.go:50: c.t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/control.go:89: c.t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/control.go:127: c.t.Helper undefined (type testing.TB has no field or method Helper)
BUILDSTDERR: _output/src/github.com/lxc/lxd/vendor/github.com/CanonicalLtd/raft-test/control.go:127: too many errors
ganto commented 6 years ago

It seems that testing.Helper() was only introduced with Go 1.9 (https://github.com/golang/go/commit/bc2931372243043842161c0a60bd2f86ef9696ee).

Therefore the build will fail on CentOS 7 (go-1.8.3) and Fedora 26 (go-1.8.7)

ganto commented 6 years ago

Issue is fixed in lxd-3.0.0-0.5 by applying a patch restoring Go 1.8 compatibility (10275752d990f21384cbb494647cac0b481b40cc)