github.com/fairyhunter13/air@v1.40.5/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 mod-tidy
    26  	@$(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 fairyhunter13/air:$(AIRVER) -f ./Dockerfile .
    46  
    47  .PHONY: push-docker-image
    48  push-docker-image:
    49  	docker push fairyhunter13/air:$(AIRVER)
    50  
    51  .PHONY: mod-tidy
    52  mod-tidy:
    53  	$(GO) mod tidy -v -compat=1.17