Open
Description
Considering
Line 245 in 572130c
Assume I want to create the following line in the config: a "b" "c";
The following code produces the result as a '"b"' '"c"';
d := crossplane.Directives{}
d = append(d, &crossplane.Directive{
Directive: "a",
Args: []string{"\"b\"", "\"c\""},
})
crossplane.BuildFiles(
crossplane.Payload{
Config: []crossplane.Config{
{
File: "abc",
Parsed: d,
},
},
},
"",
&crossplane.BuildOptions{},
)
The following code produces the result as a b c;
d := crossplane.Directives{}
d = append(d, &crossplane.Directive{
Directive: "a",
Args: []string{"b", "c"},
})
crossplane.BuildFiles(
crossplane.Payload{
Config: []crossplane.Config{
{
File: "abc",
Parsed: d,
},
},
},
"",
&crossplane.BuildOptions{},
)
Would it be a good idea to perform something like this in the needsQuote function?
if strings.HasPrefix(s, "\"") && strings.HasSuffix(s, "\"") ||
strings.HasPrefix(s, "'") && strings.HasSuffix(s, "'") {
// if the string starts and ends with quotes, it is already quoted
return false
}
Metadata
Metadata
Assignees
Labels
No labels