github.com/elves/elvish@v0.15.0/Makefile (about)

     1  default: test get
     2  
     3  get:
     4  	go get -trimpath -ldflags \
     5  		"-X github.com/elves/elvish/pkg/buildinfo.Version=$$(git describe --tags --always --dirty=-dirty) \
     6  		 -X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" .
     7  
     8  # Used by elves/up
     9  buildall:
    10  	./tools/buildall.sh
    11  
    12  generate:
    13  	go generate ./...
    14  
    15  # Run unit tests -- with race detection if the platform supports it. Go's
    16  # Windows port supports race detection, but requires GCC, so we don't enable it
    17  # there.
    18  test:
    19  	if echo `go env GOOS GOARCH` | egrep -qx '(linux|freebsd|darwin) amd64'; then \
    20  		go test -race ./... ; \
    21  	else \
    22  		go test ./... ; \
    23  	fi
    24  
    25  # Generate a basic test coverage report. This will open the report in your
    26  # browser. See also https://codecov.io/gh/elves/elvish/.
    27  cover:
    28  	go test -coverprofile=cover -coverpkg=./pkg/... ./pkg/...
    29  	go tool cover -html=cover
    30  	go tool cover -func=cover | tail -1 | awk '{ print "Overall coverage:", $$NF }'
    31  
    32  # Ensure the style of Go and Markdown source files is consistent.
    33  style:
    34  	find . -name '*.go' | xargs goimports -w
    35  	find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always --write
    36  
    37  # Check if the style of the Go and Markdown files is correct without modifying
    38  # those files.
    39  checkstyle: checkstyle-go checkstyle-md
    40  
    41  checkstyle-go:
    42  	./tools/checkstyle-go.sh
    43  
    44  checkstyle-md:
    45  	./tools/checkstyle-md.sh
    46  
    47  .SILENT: checkstyle-go checkstyle-md
    48  .PHONY: default get generate test style checkstyle checkstyle-go checkstyle-md cover