github.com/stillson/go-wf@v0.0.0-20240502203501-5781d3fae028/Makefile (about)

     1  
     2  
     3  build:
     4  	go build -o wf
     5  
     6  test:
     7  	go test ./...
     8  
     9  test-j:
    10  	go test -json ./...
    11  
    12  cover:
    13  	go test -covermode count -coverprofile=coverage.data  ./...
    14  
    15  report: cover
    16  	go tool cover -html=coverage.data -o cover.html
    17  	go tool cover -func=coverage.data -o cover.txt
    18  
    19  check-format:
    20  	test -z $$(go fmt ./...)
    21  
    22  check: check-format static-check
    23  	go vet ./...
    24  
    25  #setup: install-go init-go install-lint
    26  setup: install-lint copy-hooks
    27  
    28  copy-hooks:
    29  	chmod +x scripts/hooks/*
    30  	cp -r scripts/hooks .git/.
    31  
    32  install-lint:
    33  	sudo curl -sSfL \
    34  	https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh\
    35  	| sh -s -- -b $$(go env GOPATH)/bin latest
    36  
    37  static-check:
    38  	$$(go env GOPATH)/bin/golangci-lint run
    39  
    40  clean:
    41  	go clean
    42  	rm -f wf
    43  
    44  GO_VERSION :=1.21.6
    45  
    46  install-go:
    47  	wget "https://golang.org/dl/go$(GO_VERSION).linux-amd64.tar.gz"
    48  	sudo tar -C /usr/local -xzf go$(GO_VERSION).linux-amd64.tar.gz
    49  	rm go$(GO_VERSION).linux-amd64.tar.gz
    50  
    51  init-go:
    52  	echo 'export PATH=$$PATH:/usr/local/go/bin' >> $${HOME}/.bashrc
    53  	echo 'export PATH=$$PATH:$${HOME}/go/bin' >> $${HOME}/.bashrc