You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by mi...@apache.org on 2023/06/08 03:46:55 UTC
[shardingsphere-on-cloud] branch main updated: feat(operator): add mockgen cmd to makefile
This is an automated email from the ASF dual-hosted git repository.
miaoliyao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/main by this push:
new 3604a24 feat(operator): add mockgen cmd to makefile
new 1800364 Merge pull request #403 from moomman/add-mockgen
3604a24 is described below
commit 3604a24a625493b81e938f0ef40d1ba2793e2efb
Author: moomman <14...@qq.com>
AuthorDate: Thu Jun 8 11:39:33 2023 +0800
feat(operator): add mockgen cmd to makefile
---
shardingsphere-operator/Makefile | 10 ++++++++++
.../pkg/kubernetes/chaosmesh/mocks/store.go | 1 -
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-operator/Makefile b/shardingsphere-operator/Makefile
index f94076d..ce6835d 100644
--- a/shardingsphere-operator/Makefile
+++ b/shardingsphere-operator/Makefile
@@ -116,6 +116,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
CHECK_LINT?= $(LOCALBIN)/golangci-lint
+CHECK_MOCKGEN ?= $(LOCALBIN)/mockgen
## Tool Versions
KUSTOMIZE_VERSION ?= v4.5.7
@@ -145,3 +146,12 @@ lint: check-lint
check-lint: $(CHECK_LINT) ## Download golangci-lint-setup locally if necessary.
$(CHECK_LINT): $(LOCALBIN)
GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
+
+.PHONY: mockgen
+mockgen: check-mockgen
+ GOBIN=$(LOCALBIN) mockgen -package mockChaos -destination pkg/kubernetes/chaosmesh/mocks/store.go github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/kubernetes/chaosmesh Chaos
+
+.PHONY: check-mockgen
+check-mockgen: $(CHECK_MOCKGEN)
+$(CHECK_MOCKGEN): $(LOCALBIN)
+ GOBIN=$(LOCALBIN) go install github.com/golang/mock/mockgen@v1.6.0
diff --git a/shardingsphere-operator/pkg/kubernetes/chaosmesh/mocks/store.go b/shardingsphere-operator/pkg/kubernetes/chaosmesh/mocks/store.go
index 1cb3780..9caffb4 100644
--- a/shardingsphere-operator/pkg/kubernetes/chaosmesh/mocks/store.go
+++ b/shardingsphere-operator/pkg/kubernetes/chaosmesh/mocks/store.go
@@ -10,7 +10,6 @@ import (
v1alpha1 "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/api/v1alpha1"
chaosmesh "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/kubernetes/chaosmesh"
-
gomock "github.com/golang/mock/gomock"
types "k8s.io/apimachinery/pkg/types"
)