From d9c8bc3c7286e081d4758e906f7da097a3da015b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KevinZ=C3=B8nda?= <33132228+KevinZonda@users.noreply.github.com> Date: Fri, 5 May 2023 00:56:03 +0100 Subject: [PATCH] fix: cannot compile --- prompt/string.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/prompt/string.go b/prompt/string.go index 8bf40da..72dc80b 100644 --- a/prompt/string.go +++ b/prompt/string.go @@ -8,14 +8,16 @@ import ( "strings" ) -func (f *PromptC) Combine() *PromptC { +// Copy returns a copy of the promptc file +// this is not Clone, Copy will still contains +// the same reference to the variable +func (f *PromptC) Copy() *PromptC { nf := PromptC{ - FileInfo: f.FileInfo, + SharedInfo: f.SharedInfo, } vars := make(map[string]string) for k, v := range f.VarConstraint { - vars[k] = variable.ToPromptcValue(v) } nf.Vars = vars @@ -26,7 +28,7 @@ func (f *PromptC) Combine() *PromptC { } func (f *PromptC) OldStyle() string { - nf := f.Combine() + nf := f.Copy() nf.parsePrompt() sb := strings.Builder{} if f.Conf != nil { @@ -69,7 +71,7 @@ func (f *PromptC) OldStyle() string { } func (f *PromptC) Formatted() string { - nf := f.Combine() + nf := f.Copy() return utils.HjsonNoBrace(nf) }