elvish/Makefile
Kurtis Rader 1b5ce7f265 Fix the handling of go test -race
The `test-race-works && go test -race || go test` formulation causes
tests to be run twice on platforms that support the `-race` option if
any test fails.

Fixes #1085
2020-08-01 23:05:59 +01:00

40 lines
1.0 KiB
Makefile

default: test get
get:
go get -trimpath -ldflags \
"-X github.com/elves/elvish/pkg/buildinfo.Version=$$(git describe --tags --always --dirty=-dirty) \
-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" .
# Used by elves/up
buildall:
./tools/buildall.sh
generate:
go generate ./...
test:
if echo `go env GOOS GOARCH` | egrep -qx '(linux|freebsd|darwin|windows) amd64'; then \
go test -race ./... ; \
else \
go test ./... ; \
fi
style:
find . -name '*.go' | xargs goimports -w
find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always --write
checkstyle: checkstyle-go checkstyle-md
checkstyle-go:
echo 'Go files that need formatting:'
! find . -name '*.go' | xargs goimports -l \
| sed 's/^/ /' | grep . && echo ' None!'
checkstyle-md:
echo 'Markdown files that need formatting:'
! find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always -l \
| sed 's/^/ /' | grep . && echo ' None!'
.SILENT: checkstyle-go checkstyle-md
.PHONY: default get generate test style checkstyle checkstyle-go checkstyle-md