github.com/yang-ricky/air@v1.30.0/Makefile (about) 1 AIRVER := $(shell git describe --tags) 2 LDFLAGS += -X "main.BuildTimestamp=$(shell date -u "+%Y-%m-%d %H:%M:%S")" 3 LDFLAGS += -X "main.airVersion=$(AIRVER)" 4 LDFLAGS += -X "main.goVersion=$(shell go version | sed -r 's/go version go(.*)\ .*/\1/')" 5 6 GO := GO111MODULE=on go 7 8 .PHONY: init 9 init: 10 go install golang.org/x/lint/golint@latest 11 go install golang.org/x/tools/cmd/goimports@latest 12 @echo "Install pre-commit hook" 13 @ln -s $(shell pwd)/hooks/pre-commit $(shell pwd)/.git/hooks/pre-commit || true 14 @chmod +x ./hack/check.sh 15 16 .PHONY: setup 17 setup: init 18 git init 19 20 .PHONY: check 21 check: 22 @./hack/check.sh ${scope} 23 24 .PHONY: ci 25 ci: init 26 @$(GO) mod tidy && $(GO) mod vendor 27 28 .PHONY: build 29 build: check 30 $(GO) build -ldflags '$(LDFLAGS)' 31 32 .PHONY: install 33 install: check 34 @echo "Installing air..." 35 @$(GO) install -ldflags '$(LDFLAGS)' 36 37 .PHONY: release 38 release: check 39 GOOS=darwin GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/darwin/air 40 GOOS=linux GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/linux/air 41 GOOS=windows GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/windows/air.exe 42 43 .PHONY: docker-image 44 docker-image: 45 docker build -t cosmtrek/air:$(AIRVER) -f ./Dockerfile . 46 47 .PHONY: push-docker-image 48 push-docker-image: 49 docker push cosmtrek/air:$(AIRVER)