From 52cacf88386651ef67585b47e9ca0ffb05460cdd Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Wed, 31 Mar 2021 14:30:29 -0700 Subject: [PATCH] runtime: Format auto-generated client code for cloud-hypervisor API This patch extends the current process of generating client code for cloud-hypervisor API with an additional step, `go-fmt`, which will remove the generated `client/go.mod` file and format all auto-generated code. Fixes: #1606 Signed-off-by: Bo Chen --- src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile index 73ca84e93..260ad19ff 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -all: | update-yaml generate-client-code +all: | update-yaml generate-client-code go-fmt MK_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) YQ_INSTALLER := "$(MK_DIR)/../../../../../ci/install_yq.sh" VERSIONS_FILE := "$(MK_DIR)/../../../../../versions.yaml" @@ -17,8 +17,9 @@ generate-client-code: clean-generated-code -i /local/cloud-hypervisor.yaml \ -g go \ -o /local/client - - +go-fmt: + rm client/go.mod; \ + go fmt ./... update-yaml: ifndef YQ