Error when using go test in a Makefile

My makefile is as below:

PWD=$(shell pwd)
export GOPATH:=$(PWD)/third_party:$(PWD)

    go test -cover sample

When in do the above steps manually it works perfectly and i get the expected output

coverage: 76.0% of statements
FAIL    sample 0.009s

But When I put this command in the form of make file as shown above i get below error.
make test

 coverage: 76.0% of statements
FAIL    sample    0.009s
make: *** [test] Error 1

Please help me in by providing pointers as why Makefile is throwing error.

Make throws and error because go test exits with a non-zero value indicating the tests did not pass.

To have make ignore the return value, prepend the command with -:

	-go test -cover sample

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