Fix make don't rebuild when go.mod changed (#49)

Fix #13

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/49
Reviewed-by: delvh <dev.lh@web.de>
This commit is contained in:
Lunny Xiao 2023-03-14 18:43:05 +08:00 committed by Earl Warren
parent 0445675a10
commit 6c7b07be60
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -14,7 +14,8 @@ RUNNER_CMD_PACKAGE_PATH := codeberg.org/forgejo/runner/cmd
LINUX_ARCHS ?= linux/amd64,linux/arm64 LINUX_ARCHS ?= linux/amd64,linux/arm64
DARWIN_ARCHS ?= darwin-12/amd64,darwin-12/arm64 DARWIN_ARCHS ?= darwin-12/amd64,darwin-12/arm64
WINDOWS_ARCHS ?= windows/amd64 WINDOWS_ARCHS ?= windows/amd64
GOFILES := $(shell find . -type f -name "*.go" ! -name "generated.*") GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
ifneq ($(shell uname), Darwin) ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null) EXTLDFLAGS = -extldflags "-static" $(null)
@ -70,7 +71,7 @@ fmt:
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) install mvdan.cc/gofumpt@latest; \ $(GO) install mvdan.cc/gofumpt@latest; \
fi fi
$(GOFMT) -w $(GOFILES) $(GOFMT) -w $(GO_FMT_FILES)
vet: vet:
$(GO) vet ./... $(GO) vet ./...
@ -80,7 +81,7 @@ fmt-check:
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) install mvdan.cc/gofumpt@latest; \ $(GO) install mvdan.cc/gofumpt@latest; \
fi fi
@diff=$$($(GOFMT) -d $(GOFILES)); \ @diff=$$($(GOFMT) -d $(GO_FMT_FILES)); \
if [ -n "$$diff" ]; then \ if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \ echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \ echo "$${diff}"; \