Build target for "make tidy" (#2378)
The make tidy target runs "go mod tidy" in the root directory and all plugins.
This commit is contained in:
parent
5e7c0e0f49
commit
1a6f12c88e
10 changed files with 33 additions and 23 deletions
18
Makefile
18
Makefile
|
@ -31,8 +31,8 @@ BUILD_REQUIRE_GO_MINOR ?= 20
|
||||||
|
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOTEST = $(GOCMD) test
|
GOTEST = $(GO) test
|
||||||
|
|
||||||
BUILD_CODENAME ?= alphaga
|
BUILD_CODENAME ?= alphaga
|
||||||
|
|
||||||
|
@ -209,12 +209,21 @@ PLUGIN_VENDOR = $(foreach plugin,$(PLUGINS),$(shell if [ -f $(PLUGINS_DIR)/$(plu
|
||||||
vendor:
|
vendor:
|
||||||
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
||||||
cd $(plugin_dir) >/dev/null && \
|
cd $(plugin_dir) >/dev/null && \
|
||||||
$(GOCMD) mod vendor && \
|
$(GO) mod vendor && \
|
||||||
cd - >/dev/null; \
|
cd - >/dev/null; \
|
||||||
)
|
)
|
||||||
$(GOCMD) mod vendor
|
$(GO) mod vendor
|
||||||
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
|
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
|
||||||
|
|
||||||
|
.PHONY: tidy
|
||||||
|
tidy:
|
||||||
|
$(GO) mod tidy
|
||||||
|
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
||||||
|
cd $(plugin_dir) >/dev/null && \
|
||||||
|
$(GO) mod tidy && \
|
||||||
|
cd - >/dev/null; \
|
||||||
|
)
|
||||||
|
|
||||||
# remove vendor directories and vendor.tgz
|
# remove vendor directories and vendor.tgz
|
||||||
.PHONY: vendor-remove
|
.PHONY: vendor-remove
|
||||||
vendor-remove:
|
vendor-remove:
|
||||||
|
@ -223,6 +232,7 @@ vendor-remove:
|
||||||
)
|
)
|
||||||
$(RM) vendor vendor.tgz
|
$(RM) vendor vendor.tgz
|
||||||
|
|
||||||
|
|
||||||
.PHONY: package
|
.PHONY: package
|
||||||
package:
|
package:
|
||||||
@echo "Building Release to dir $(RELDIR)"
|
@echo "Building Release to dir $(RELDIR)"
|
||||||
|
|
|
@ -5,9 +5,9 @@ ifeq ($(OS), Windows_NT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Go parameters
|
# Go parameters
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
GOTEST = $(GOCMD) test
|
GOTEST = $(GO) test
|
||||||
|
|
||||||
BINARY_NAME = cscli$(EXT)
|
BINARY_NAME = cscli$(EXT)
|
||||||
PREFIX ?= "/"
|
PREFIX ?= "/"
|
||||||
|
|
|
@ -5,9 +5,9 @@ ifeq ($(OS), Windows_NT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Go parameters
|
# Go parameters
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
GOTEST = $(GOCMD) test
|
GOTEST = $(GO) test
|
||||||
|
|
||||||
CROWDSEC_BIN = crowdsec$(EXT)
|
CROWDSEC_BIN = crowdsec$(EXT)
|
||||||
# names longer than 15 chars break 'pgrep'
|
# names longer than 15 chars break 'pgrep'
|
||||||
|
|
|
@ -25,7 +25,7 @@ def test_capi_whitelists(crowdsec, tmp_path_factory, flavor,):
|
||||||
with crowdsec(flavor=flavor, environment=env, volumes=volumes) as cs:
|
with crowdsec(flavor=flavor, environment=env, volumes=volumes) as cs:
|
||||||
cs.wait_for_log("*Starting processing data*")
|
cs.wait_for_log("*Starting processing data*")
|
||||||
cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
|
cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
|
||||||
res = cs.cont.exec_run(f'cscli config show-yaml')
|
res = cs.cont.exec_run('cscli config show-yaml')
|
||||||
assert res.exit_code == 0
|
assert res.exit_code == 0
|
||||||
stdout = res.output.decode()
|
stdout = res.output.decode()
|
||||||
y = yaml.safe_load(stdout)
|
y = yaml.safe_load(stdout)
|
||||||
|
|
|
@ -7,8 +7,8 @@ endif
|
||||||
PLUGIN = dummy
|
PLUGIN = dummy
|
||||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
|
@ -7,8 +7,8 @@ endif
|
||||||
PLUGIN = email
|
PLUGIN = email
|
||||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
|
@ -7,8 +7,8 @@ endif
|
||||||
PLUGIN=http
|
PLUGIN=http
|
||||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
|
@ -5,8 +5,8 @@ ifeq ($(OS), Windows_NT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Go parameters
|
# Go parameters
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
BINARY_NAME = notification-sentinel$(EXT)
|
BINARY_NAME = notification-sentinel$(EXT)
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ endif
|
||||||
PLUGIN=slack
|
PLUGIN=slack
|
||||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
|
@ -7,8 +7,8 @@ endif
|
||||||
PLUGIN=splunk
|
PLUGIN=splunk
|
||||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||||
|
|
||||||
GOCMD = go
|
GO = go
|
||||||
GOBUILD = $(GOCMD) build
|
GOBUILD = $(GO) build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
Loading…
Reference in a new issue