build: add the X option to the stack directive.

This commit is contained in:
Alexandre Pujol 2024-09-10 18:13:48 +01:00
parent 67c5181ba9
commit f3094cc741
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
6 changed files with 30 additions and 8 deletions

View file

@ -14,7 +14,7 @@ import (
var (
regFlags = regexp.MustCompile(`flags=\(([^)]+)\)`)
regProfileHeader = regexp.MustCompile(` {`)
regProfileHeader = regexp.MustCompile(` {\n`)
)
type Complain struct {
@ -40,7 +40,7 @@ func (b Complain) Apply(opt *Option, profile string) (string, error) {
}
}
flags = append(flags, "complain")
strFlags := " flags=(" + strings.Join(flags, ",") + ") {"
strFlags := " flags=(" + strings.Join(flags, ",") + ") {\n"
// Remove all flags definition, then set manifest' flags
profile = regFlags.ReplaceAllLiteralString(profile, "")

View file

@ -36,9 +36,9 @@ func (b Enforce) Apply(opt *Option, profile string) (string, error) {
return profile, nil
}
flags = slices.Delete(flags, idx, idx+1)
strFlags := "{"
strFlags := "{\n"
if len(flags) >= 1 {
strFlags = " flags=(" + strings.Join(flags, ",") + ") {"
strFlags = " flags=(" + strings.Join(flags, ",") + ") {\n"
}
// Remove all flags definition, then set new flags