From dfc54fde7151db7ab8359456d7ab0f45ae202541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20ESTEGUET?= <106679334+ehl-jf@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:10:56 +0100 Subject: [PATCH] Fix mock generation in CI (#11) --- Makefile | 5 +++-- commands/common/cmd_commons.go | 2 +- commands/common/manifest.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index eb8d177..336cc6a 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,8 @@ GOLANGCI_LINT: ########## BUILD ########## prereq:: - ${GOCMD} install github.com/jstemmer/go-junit-report@v1.0.0 + $(GOCMD) install github.com/jstemmer/go-junit-report@v1.0.0 + GOBIN=${TOOLS_DIR} $(GOCMD) install go.uber.org/mock/mockgen@v0.5.0 build:: go env GOOS GOARCH @@ -67,7 +68,7 @@ clean-mock: .PHONY: generate-mock generate-mock: clean-mock @echo Generating test mocks - go generate ./... + TOOLS_DIR=$(TOOLS_DIR) go generate ./... test-prereq: prereq generate-mock mkdir -p target/reports diff --git a/commands/common/cmd_commons.go b/commands/common/cmd_commons.go index 29985bf..87f322d 100644 --- a/commands/common/cmd_commons.go +++ b/commands/common/cmd_commons.go @@ -1,6 +1,6 @@ package common -//go:generate mockgen -source=${GOFILE} -destination=mocks/${GOFILE} +//go:generate ${TOOLS_DIR}/mockgen -source=${GOFILE} -destination=mocks/${GOFILE} import ( "bytes" diff --git a/commands/common/manifest.go b/commands/common/manifest.go index 9234e16..db8359f 100644 --- a/commands/common/manifest.go +++ b/commands/common/manifest.go @@ -1,6 +1,6 @@ package common -//go:generate mockgen -source=${GOFILE} -destination=mocks/${GOFILE} +//go:generate ${TOOLS_DIR}/mockgen -source=${GOFILE} -destination=mocks/${GOFILE} import ( "encoding/json"