mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Set the GOPATH if not set when using the Makefile
This commit is contained in:
parent
48cb7ba773
commit
0f86740a7f
18
Makefile
18
Makefile
@ -1,7 +1,23 @@
|
|||||||
.PHONY: contrib_check dependencies install run size
|
.PHONY: contrib_check dependencies install run size
|
||||||
|
|
||||||
|
# detect GOPATH if not set
|
||||||
|
ifndef $(GOPATH)
|
||||||
|
$(info GOPATH is not set, autodetecting..)
|
||||||
|
TESTPATH := $(dir $(abspath ../../..))
|
||||||
|
DIRS := bin pkg src
|
||||||
|
# create a ; separated line of tests and pass it to shell
|
||||||
|
MISSING_DIRS := $(shell $(foreach entry,$(DIRS),test -d "$(TESTPATH)$(entry)" || echo "$(entry)";))
|
||||||
|
ifeq ($(MISSING_DIRS),)
|
||||||
|
$(info Found GOPATH: $(TESTPATH))
|
||||||
|
export GOPATH := $(TESTPATH)
|
||||||
|
else
|
||||||
|
$(info ..missing dirs "$(MISSING_DIRS)" in "$(TESTDIR)")
|
||||||
|
$(info GOPATH autodetection failed)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -race -o bin/wtf
|
go build -o bin/wtf
|
||||||
|
|
||||||
contrib_check:
|
contrib_check:
|
||||||
npx all-contributors-cli check
|
npx all-contributors-cli check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user