Skip to content

Commit 24c1e37

Browse files
Fix handling of attest extra arguments
Signed-off-by: Laurent Goderre <[email protected]>
1 parent 4e91fe6 commit 24c1e37

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

util/buildflags/attests.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ func (a *Attest) UnmarshalText(text []byte) error {
148148
if !ok {
149149
return errors.Errorf("invalid value %s", field)
150150
}
151-
key = strings.TrimSpace(strings.ToLower(key))
152151

153-
switch key {
152+
switch strings.TrimSpace(strings.ToLower(key)) {
154153
case "type":
155154
a.Type = value
156155
case "disabled":

util/buildflags/export.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package buildflags
22

33
import (
4+
"encoding/csv"
45
"encoding/json"
56
"maps"
67
"regexp"
@@ -259,9 +260,16 @@ func (w *csvBuilder) Write(key, value string) {
259260
if w.sb.Len() > 0 {
260261
w.sb.WriteByte(',')
261262
}
262-
w.sb.WriteString(key)
263-
w.sb.WriteByte('=')
264-
w.sb.WriteString(value)
263+
264+
var attr strings.Builder
265+
writer := csv.NewWriter(&attr)
266+
267+
writer.Write([]string{
268+
key + "=" + value,
269+
})
270+
writer.Flush()
271+
272+
w.sb.WriteString(strings.TrimSpace(attr.String()))
265273
}
266274

267275
func (w *csvBuilder) WriteAttributes(attrs map[string]string) {

0 commit comments

Comments
 (0)