mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 02:57:52 +08:00
1b5ce7f265
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
40 lines
1.0 KiB
Makefile
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
|