From 88053fcbfac41eecbc00a4728838362ea9b95e09 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sun, 13 Jun 2021 11:29:04 -0400 Subject: [PATCH] [vtctldclient] Restructure code organization for doing codegen on a local client Signed-off-by: Andrew Mason --- Makefile | 4 ++-- go/vt/vtctl/grpcvtctldclient/client.go | 2 +- go/vt/vtctl/{grpcvtctldclient => vtctldclient}/Makefile | 8 +++++--- .../{grpcvtctldclient => vtctldclient}/codegen/main.go | 0 .../codegen/template.go | 0 5 files changed, 8 insertions(+), 6 deletions(-) rename go/vt/vtctl/{grpcvtctldclient => vtctldclient}/Makefile (86%) rename go/vt/vtctl/{grpcvtctldclient => vtctldclient}/codegen/main.go (100%) rename go/vt/vtctl/{grpcvtctldclient => vtctldclient}/codegen/template.go (100%) diff --git a/Makefile b/Makefile index 64e2941669..4cdb9fb60c 100644 --- a/Makefile +++ b/Makefile @@ -126,8 +126,8 @@ install-testing: build mkdir -p "$${PREFIX}/web/vtctld2" cp -R web/vtctld2/app "$${PREFIX}/web/vtctld2" -grpcvtctldclient: go/vt/proto/vtctlservice/vtctlservice.pb.go - make -C go/vt/vtctl/grpcvtctldclient +vtctldclient: go/vt/proto/vtctlservice/vtctlservice.pb.go + make -C go/vt/vtctl/vtctldclient parser: make -C go/vt/sqlparser diff --git a/go/vt/vtctl/grpcvtctldclient/client.go b/go/vt/vtctl/grpcvtctldclient/client.go index 45e19ff88e..e688e998da 100644 --- a/go/vt/vtctl/grpcvtctldclient/client.go +++ b/go/vt/vtctl/grpcvtctldclient/client.go @@ -35,7 +35,7 @@ type gRPCVtctldClient struct { c vtctlservicepb.VtctldClient } -//go:generate -command grpcvtctldclient go run ./codegen +//go:generate -command grpcvtctldclient go run ../vtctldclient/codegen //go:generate grpcvtctldclient -out client_gen.go func gRPCVtctldClientFactory(addr string) (vtctldclient.VtctldClient, error) { diff --git a/go/vt/vtctl/grpcvtctldclient/Makefile b/go/vt/vtctl/vtctldclient/Makefile similarity index 86% rename from go/vt/vtctl/grpcvtctldclient/Makefile rename to go/vt/vtctl/vtctldclient/Makefile index d40d962d70..6306c92b73 100644 --- a/go/vt/vtctl/grpcvtctldclient/Makefile +++ b/go/vt/vtctl/vtctldclient/Makefile @@ -14,6 +14,8 @@ MAKEFLAGS = -s -generate: - go generate ./... - gofmt -w client_gen.go +all: grpcvtctldclient + +grpcvtctldclient: + go generate ../$@/... + gofmt -w ../$@/client_gen.go diff --git a/go/vt/vtctl/grpcvtctldclient/codegen/main.go b/go/vt/vtctl/vtctldclient/codegen/main.go similarity index 100% rename from go/vt/vtctl/grpcvtctldclient/codegen/main.go rename to go/vt/vtctl/vtctldclient/codegen/main.go diff --git a/go/vt/vtctl/grpcvtctldclient/codegen/template.go b/go/vt/vtctl/vtctldclient/codegen/template.go similarity index 100% rename from go/vt/vtctl/grpcvtctldclient/codegen/template.go rename to go/vt/vtctl/vtctldclient/codegen/template.go