From cc62d73017f9abb51fa7e517c29d35b1daf38dfb Mon Sep 17 00:00:00 2001 From: closetool Date: Thu, 16 Feb 2023 10:41:13 +0800 Subject: [PATCH] fix: no data in gitops repo Signed-off-by: closetool --- pkg/cluster/gitrepo/gitrepo_cluster.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/cluster/gitrepo/gitrepo_cluster.go b/pkg/cluster/gitrepo/gitrepo_cluster.go index 1cd6e8ba..60669837 100644 --- a/pkg/cluster/gitrepo/gitrepo_cluster.go +++ b/pkg/cluster/gitrepo/gitrepo_cluster.go @@ -1286,11 +1286,13 @@ func assembleTags(templateName string, } func marshal(b *[]byte, err *error, data interface{}) { - buf := bytes.NewBuffer(*b) + buf := bytes.NewBuffer(make([]byte, 0)) encoder := yaml.NewEncoder(buf) encoder.SetIndent(2) *err = encoder.Encode(data) if (*err) != nil { *err = perror.Wrap(herrors.ErrParamInvalid, (*err).Error()) + } else { + *b = buf.Bytes() } }