Skip to content

Commit

Permalink
Makefile: avoid spurious error messge on first run
Browse files Browse the repository at this point in the history
My first run of "make test" gave me this harmless error

	make[1]: Entering directory '/home/johannes/git/lab'
	rm coverage-* 2>&1 > /dev/null || true
	rm: cannot remove 'coverage-*': No such file or directory

The redirections are meant to silence the error but fail because
"> /dev/null" does not change the earlier redirection of stderr to
stdout. It would work if written as ">/dev/null 2>&1". Even better,
let's just use "rm -f", then we don't need to check the exit code
either.

Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
  • Loading branch information
krobelus committed Oct 26, 2021
1 parent e6dca2d commit 57abeb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test:
bash -c "trap 'trap - SIGINT SIGTERM ERR; mv testdata/.git testdata/test.git; rm coverage-* 2>&1 > /dev/null; exit 1' SIGINT SIGTERM ERR; $(MAKE) internal-test"

internal-test:
rm coverage-* 2>&1 > /dev/null || true
rm -f coverage-*
GO111MODULE=on go test -coverprofile=coverage-main.out -covermode=count -coverpkg ./... -run=$(run) $(GOURL)/cmd $(GOURL)/internal/...
go get -u github.com/wadey/gocovmerge
gocovmerge coverage-*.out > coverage.txt && rm coverage-*.out
Expand Down

0 comments on commit 57abeb1

Please sign in to comment.