Commit e5015047 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'jv-remove-make-find' into 'master'

Makefile: remove find NO CHANGELOG

See merge request gitlab-org/gitlab-workhorse!669
parents b91c4d62 49f79932
...@@ -22,8 +22,6 @@ export PATH := $(GOBIN):$(PATH) ...@@ -22,8 +22,6 @@ export PATH := $(GOBIN):$(PATH)
export GOPROXY ?= https://proxy.golang.org export GOPROXY ?= https://proxy.golang.org
export GO111MODULE=on export GO111MODULE=on
LOCAL_GO_FILES = $(shell find . -type f -name '*.go' | grep -v -e /_ -e /testdata/ -e '^\./\.')
define message define message
@echo "### $(1)" @echo "### $(1)"
endef endef
...@@ -40,19 +38,23 @@ $(TARGET_SETUP): ...@@ -40,19 +38,23 @@ $(TARGET_SETUP):
mkdir -p "$(TARGET_DIR)" mkdir -p "$(TARGET_DIR)"
touch "$(TARGET_SETUP)" touch "$(TARGET_SETUP)"
gitlab-resize-image: $(TARGET_SETUP) $(shell find cmd/gitlab-resize-image/ -name '*.go') .PHONY: gitlab-resize-image
gitlab-resize-image: $(TARGET_SETUP)
$(call message,Building $@) $(call message,Building $@)
$(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@
gitlab-zip-cat: $(TARGET_SETUP) $(shell find cmd/gitlab-zip-cat/ -name '*.go') .PHONY: gitlab-zip-cat
gitlab-zip-cat: $(TARGET_SETUP)
$(call message,Building $@) $(call message,Building $@)
$(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@
gitlab-zip-metadata: $(TARGET_SETUP) $(shell find cmd/gitlab-zip-metadata/ -name '*.go') .PHONY: gitlab-zip-metadata
gitlab-zip-metadata: $(TARGET_SETUP)
$(call message,Building $@) $(call message,Building $@)
$(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@
gitlab-workhorse: $(TARGET_SETUP) $(shell find . -name '*.go' | grep -v '^\./_') .PHONY: gitlab-workhorse
gitlab-workhorse: $(TARGET_SETUP)
$(call message,Building $@) $(call message,Building $@)
$(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG) $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)
...@@ -142,7 +144,7 @@ detect-assert: ...@@ -142,7 +144,7 @@ detect-assert:
.PHONY: check-formatting .PHONY: check-formatting
check-formatting: $(TARGET_SETUP) install-goimports check-formatting: $(TARGET_SETUP) install-goimports
$(call message,Verify: $@) $(call message,Verify: $@)
@_support/validate-formatting.sh $(LOCAL_GO_FILES) @_support/fmt.sh check
# Megacheck will tailor some responses given a minimum Go version, so pass that through the CLI # Megacheck will tailor some responses given a minimum Go version, so pass that through the CLI
# Additionally, megacheck will not return failure exit codes unless explicitly told to via the # Additionally, megacheck will not return failure exit codes unless explicitly told to via the
...@@ -158,7 +160,7 @@ staticcheck: $(TARGET_SETUP) ...@@ -158,7 +160,7 @@ staticcheck: $(TARGET_SETUP)
.PHONY: fmt .PHONY: fmt
fmt: $(TARGET_SETUP) install-goimports fmt: $(TARGET_SETUP) install-goimports
$(call message,$@) $(call message,$@)
@goimports -w -local $(PKG) -l $(LOCAL_GO_FILES) @_support/fmt.sh
.PHONY: goimports .PHONY: goimports
install-goimports: $(TARGET_SETUP) install-goimports: $(TARGET_SETUP)
......
#!/bin/sh
FLAG=-w
if [ "x$1" = xcheck ]; then
FLAG=-e
fi
IMPORT_RESULT=$(
goimports $FLAG -local "gitlab.com/gitlab-org/gitlab-workhorse" -l $(
find . -type f -name '*.go' | grep -v -e /_ -e /testdata/ -e '^\./\.'
)
)
case "x$1" in
xcheck)
if [ -n "${IMPORT_RESULT}" ]; then
echo >&2 "Formatting or imports need fixing: 'make fmt'"
echo "${IMPORT_RESULT}"
exit 1
fi
;;
x)
echo "${IMPORT_RESULT}"
;;
esac
#!/bin/sh
IMPORT_RESULT=$(goimports -e -local "gitlab.com/gitlab-org/gitlab-workhorse" -l "$@")
if [ -n "${IMPORT_RESULT}" ]; then
echo >&2 "Formatting or imports need fixing: 'make fmt'"
echo "${IMPORT_RESULT}"
exit 1
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment