Testsuite failed: make testsuite: package github.com/docker/libcompose: cannot download

Hi Team,

I'm trying to perform testing for filebeat, but getting below problem with libcompose.
package github.com/docker/libcompose: cannot download, $GOPATH must not be set to $GOROOT. For more details see: 'go help gopath

go version
go version go1.12.5 linux/amd64

virtualenv --version
16.5.0

Command:
make testsuite

Full logs:

make[1]: Entering directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
/root/.magefile cleaned
  No LICENSE.txt / LICENSE found in source
New python executable in /usr/local/go/src/github.com/elastic/beats/libbeat/build/python-env/bin/python2
Also creating executable in /usr/local/go/src/github.com/elastic/beats/libbeat/build/python-env/bin/python
Installing setuptools, pip, wheel...
done.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
make[2]: Entering directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
mage -v fields
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
Running target: Fields
Found Elastic Beats dir at /usr/local/go/src/github.com/elastic/beats
exec: go run /usr/local/go/src/github.com/elastic/beats/libbeat/scripts/cmd/global_fields/main.go -es_beats_path /usr/local/go/src/github.com/elastic/beats -beat_path /usr/local/go/src/github.com/elastic/beats/libbeat processors
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
Generated fields.yml for libbeat
make[2]: Leaving directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
Updating generated files for libbeat
cat: _meta/beat.yml: No such file or directory
cat: _meta/beat.yml: No such file or directory
if [ -d /usr/local/go/src/github.com/elastic/beats/libbeat/_meta/kibana ]; then \
	cp -pr /usr/local/go/src/github.com/elastic/beats/libbeat/_meta/kibana/* /usr/local/go/src/github.com/elastic/beats/libbeat/_meta/kibana.generated ; \
fi
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
-- The index pattern was created under /usr/local/go/src/github.com/elastic/beats/libbeat/_meta/kibana.generated/5/index-pattern/libbeat.json
-- The index pattern was created under /usr/local/go/src/github.com/elastic/beats/libbeat/_meta/kibana.generated/6/index-pattern/libbeat.json
make unit-tests
make[2]: Entering directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
mkdir -p /usr/local/go/src/github.com/elastic/beats/libbeat/build/coverage
# gotestcover is needed to fetch coverage for multiple packages
go get github.com/elastic/beats/vendor/github.com/pierrre/gotestcover
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
# testify is needed for unit and integration tests
go get github.com/elastic/beats/vendor/github.com/stretchr/testify/assert
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
# libcompose is needed for integration tests
go get github.com/docker/libcompose
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
package github.com/docker/libcompose: cannot download, $GOPATH must not be set to $GOROOT. For more details see: 'go help gopath'
make[2]: *** [prepare-tests] Error 1
make[2]: Leaving directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
make[1]: *** [testsuite] Error 2
make[1]: Leaving directory `/usr/local/go/src/github.com/elastic/beats/libbeat'
make: *** [testsuite] Error 1

Please help me to get out of this.

Thanks in advance!

Best Regards,
Harsh Bajaj

Hi @harshbajaj16,

The error mentions that $GOPATH is set to $GOROOT, what is the value of these environment variables?
You cah see it with echo $GOPATH and echo $GOROOT.

HI @jsoriano,

Thank you for your reply.

i didn't set GOROOT path and also checked with echo $GOROOT its showing nothing.

However, if i run go env command it is showing by default GOPATH and GOROOT as same.

> #go env

-----
GOPATH="/usr/local/go"
GORACE=""
GOROOT="/usr/local/go"
-----

could you pls help that how to unset the same in go env ??

Regards,
Harsh Bajaj

You will need to set a GOPATH for your user so packages can be installed there, you can for example create a gocode directory in your home and export GOPATH=$HOME/gocode.

Hi @Jasonespo,

Thank you for your reply!

It was helpful for me. However, after this step i was getting bin/gotestcover: No such file or directory error and test suite failed.

Solution:
I've copied the bin/ directory from go lang installed directory i.e. /usr/local/go/bin into $GOPATH ($HOME/gocode) directory to resolve this problem.

Regards,
Harsh Bajaj

1 Like

@harshbajaj16 you can also add the $GOPATH/bin directory to your $PATH instead of copying the binaries.

HI @jsoriano,

Thank you but i'm not able to understand this. because i've copied the full bin/ directory from /usr/local/go and as per you$GOPATH/bin directory should contains bin/ directory to set $PATH and for this i need to copy the bin directory in GOPATH.

Please let me know if i misunderstood you.

Regards,
Harsh Bajaj

Just modify your PATH with something like export PATH=$GOPATH/bin:$PATH, so your terminal can find the commands installed in the GOPATH without needing to copy them :slightly_smiling_face:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.