diff --git a/Makefile b/Makefile index 35491dc..a3d8581 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,12 @@ OUT=my-log GOBIN=$(shell go env GOBIN) COVEROUT=cover.out COVERHTML=cover.html +OPEN=xdg-open +OS=$(shell uname -s) + +ifeq ($(OS),Darwin) +OPEN=open +endif .PHONY: help help: ## Show help for documented recipes @@ -23,7 +29,8 @@ test: ## Test application and generate coverage report $(MAKE) clean $(MAKE) $(COVEROUT) -$(COVEROUT): $(SOURCES) fmt +$(COVEROUT): $(SOURCES) + $(MAKE) fmt go test ./... -race -cover -coverprofile $@ $(COVERHTML): $(COVEROUT) @@ -33,8 +40,8 @@ $(COVERHTML): $(COVEROUT) report: $(COVERHTML) ## Generate a coverage report .PHONY: open-report -open-report: report ## Open the coverage report in the default browser - xdg-open $(COVERHTML) +open-report: $(COVERHTML) ## Open the coverage report in the default browser + $(OPEN) $< .PHONY: build build: $(OUT) ## Builds the application diff --git a/files/append_test.go b/files/append_test.go index 0976363..03f0253 100644 --- a/files/append_test.go +++ b/files/append_test.go @@ -211,7 +211,7 @@ func (s *AppendTestSuite) TestConfLoadErr() { func (s *AppendTestSuite) TestMkdirErr() { // Don't run this test as root - config.Overrides["input.path"] = "/root/my-logs-test" + config.Overrides["input.path"] = "/var/my-logs-test" defer func(path string) { config.Overrides["input.path"] = path }(s.dir)