Workhorse: Move root *.go files into cmd/gitlab-workhorse
Overview
Currently, the root of Workhorse project contains a lot of *.go
files under main
package:
authorization_test.go cable_test.go gitaly_integration_test.go listener.go main.go raven.go upload_test.go
backend.go channel_test.go gitaly_test.go listener_test.go main_test.go sendfile_test.go
backend_test.go config_test.go jobs_test.go logging.go proxy_test.go tools.go
They are compiled/build into gitlab-workhorse
section of Makefile
:
.PHONY: gitlab-workhorse
gitlab-workhorse:
$(call message,Building $@)
go build -ldflags "$(GO_BUILD_GENERIC_LDFLAGS)" -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)
ifndef WITHOUT_BUILD_ID
go build -ldflags "$(GO_BUILD_GENERIC_LDFLAGS) -B 0x$$(_support/make-gnu-build-id.sh $(BUILD_DIR)/$@)" -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)
endif
Proposal
Move all the Go files into cmd/gitlab-workhorse
directory and build them just like all other packages in cmd
directory:
.PHONY: gitlab-resize-image gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
gitlab-resize-image gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse:
$(call message,Building $@)
go build -ldflags "$(GO_BUILD_GENERIC_LDFLAGS)" -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@
ifndef WITHOUT_BUILD_ID
go build -ldflags "$(GO_BUILD_GENERIC_LDFLAGS) -B 0x$$(_support/make-gnu-build-id.sh $(BUILD_DIR)/$@)" -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@
endif