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
|
||||
GOTEST = $(GOCMD) test
|
||||
GO = go
|
||||
GOTEST = $(GO) test
|
||||
|
||||
BUILD_CODENAME ?= alphaga
|
||||
|
||||
|
@ -209,12 +209,21 @@ PLUGIN_VENDOR = $(foreach plugin,$(PLUGINS),$(shell if [ -f $(PLUGINS_DIR)/$(plu
|
|||
vendor:
|
||||
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
|
||||
cd $(plugin_dir) >/dev/null && \
|
||||
$(GOCMD) mod vendor && \
|
||||
$(GO) mod vendor && \
|
||||
cd - >/dev/null; \
|
||||
)
|
||||
$(GOCMD) mod vendor
|
||||
$(GO) mod 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
|
||||
.PHONY: vendor-remove
|
||||
vendor-remove:
|
||||
|
@ -223,6 +232,7 @@ vendor-remove:
|
|||
)
|
||||
$(RM) vendor vendor.tgz
|
||||
|
||||
|
||||
.PHONY: package
|
||||
package:
|
||||
@echo "Building Release to dir $(RELDIR)"
|
||||
|
|
|
@ -5,9 +5,9 @@ ifeq ($(OS), Windows_NT)
|
|||
endif
|
||||
|
||||
# Go parameters
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GOTEST = $(GOCMD) test
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
GOTEST = $(GO) test
|
||||
|
||||
BINARY_NAME = cscli$(EXT)
|
||||
PREFIX ?= "/"
|
||||
|
|
|
@ -5,9 +5,9 @@ ifeq ($(OS), Windows_NT)
|
|||
endif
|
||||
|
||||
# Go parameters
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GOTEST = $(GOCMD) test
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
GOTEST = $(GO) test
|
||||
|
||||
CROWDSEC_BIN = crowdsec$(EXT)
|
||||
# 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:
|
||||
cs.wait_for_log("*Starting processing data*")
|
||||
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
|
||||
stdout = res.output.decode()
|
||||
y = yaml.safe_load(stdout)
|
||||
|
|
|
@ -7,8 +7,8 @@ endif
|
|||
PLUGIN = dummy
|
||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
build: clean
|
||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||
|
|
|
@ -7,8 +7,8 @@ endif
|
|||
PLUGIN = email
|
||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
build: clean
|
||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||
|
|
|
@ -7,8 +7,8 @@ endif
|
|||
PLUGIN=http
|
||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
build: clean
|
||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||
|
|
|
@ -5,8 +5,8 @@ ifeq ($(OS), Windows_NT)
|
|||
endif
|
||||
|
||||
# Go parameters
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
BINARY_NAME = notification-sentinel$(EXT)
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ endif
|
|||
PLUGIN=slack
|
||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
build: clean
|
||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||
|
|
|
@ -7,8 +7,8 @@ endif
|
|||
PLUGIN=splunk
|
||||
BINARY_NAME = notification-$(PLUGIN)$(EXT)
|
||||
|
||||
GOCMD = go
|
||||
GOBUILD = $(GOCMD) build
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
|
||||
build: clean
|
||||
$(GOBUILD) $(LD_OPTS) $(BUILD_VENDOR_FLAGS) -o $(BINARY_NAME)
|
||||
|
|
Loading…
Reference in a new issue