github.com/nats-io/nsc@v0.0.0-20221206222106-35db9400b257/Makefile (about)

     1  CWD:=$(shell echo `pwd`)
     2  BUILD_DIR:=$(CWD)/build
     3  BUILD_OS:=`go env GOOS`
     4  BUILD_OS_ARCH:=`go env GOARCH`
     5  BUILD_OS_GOPATH=`go env GOPATH`
     6  
     7  .PHONY: build test release
     8  
     9  build: compile
    10  
    11  fmt:
    12  	gofmt -s -w *.go
    13  	gofmt -s -w cmd/*.go
    14  	gofmt -s -w cmd/store/*.go
    15  
    16  	goimports -w *.go
    17  	goimports -w cmd/*.go
    18  	goimports -w cmd/store/*.go
    19  
    20  	go mod tidy
    21  
    22  compile:
    23  	goreleaser --snapshot --rm-dist --skip-validate --skip-publish --parallelism 12
    24  
    25  install: compile build
    26  	cp $(BUILD_DIR)/nsc_$(BUILD_OS)_$(BUILD_OS_ARCH)/* $(BUILD_OS_GOPATH)/bin
    27  
    28  cover: test
    29  	go tool cover -html=./coverage.out
    30  
    31  # The NSC_*_OPERATOR unset is because those variables pre-define operators which break the interactive tests
    32  test:
    33  	go mod vendor
    34  	go vet ./...
    35  	rm -rf ./coverage.out
    36  	staticcheck -f text ./...
    37  	unset $$(env | sed -nEe 's/^(NSC_[^=]*_OPERATOR)=.*/\1/p'); go test -coverpkg=./... -coverprofile=./coverage.out ./...
    38  	staticcheck ./...
    39  
    40  release: fmt test compile
    41  
    42  lint:
    43  	go vet ./...
    44  	staticcheck -f text ./...
    45  	$(exit $(go fmt $EXCLUDE_VENDOR | wc -l))