他们的 README.md 中的示例是export CMDLINE="go test"export PKGS="./..." # IMPORTANT make sure packages are written SEPERATLYnabaz test --cmdline $CMDLINE --pkgs $PKGS .
你可以使用make. 如果测试文件没有更改,它不会再次重新运行测试。make: `test' is up to date.这就是您可以编写Makefile 的方法。# To run commands just use "make" and make function name# ex- <make run> use for run go run main.go# Go parametersexecution: echo "** Executing Makefile**"GOCMD=goGOINSTALL=$(GOCMD) installGOBUILD=$(GOCMD) buildGOCLEAN=$(GOCMD) cleanGOTEST=$(GOCMD) testGOGET=$(GOCMD) getGORUN=$(GOCMD) runBINARY_NAME=reservationsBINARY_UNIX=$(BINARY_NAME)_unixexecute: - echo "Running the build - reservations" - ~/go/bin/reservations-backendinstall: - echo "Building the module" # will create a executable file at $GOPATH - $(GOINSTALL)run: - @echo "Running the application - reservations" - $(GORUN) $(BINARY_NAME)#NOTE: @ before a command will stop showing that command.test: - @echo "** Running Tests **" - $(GOTEST) -race ./test -v