Skip to content

Commit dae82e7

Browse files
committed
treewide: go fix
1 parent 7ff8647 commit dae82e7

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

internal/cryptsetup/cryptsetup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ type cryptsetupMetadata struct {
319319
JournalEncryption string `json:"journal_encryption"`
320320
JournalIntegrity string `json:"journal_integrity"`
321321
KeySize int `json:"key_size"`
322-
} `json:"integrity,omitempty"`
322+
} `json:"integrity"`
323323
} `json:"segments"`
324324
Digests map[string]struct {
325325
Type string `json:"type"`

internal/kuberesource/parts.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package kuberesource
66
import (
77
"fmt"
88
"strconv"
9+
"strings"
910

1011
"github.com/edgelesssys/contrast/internal/manifest"
1112
"github.com/edgelesssys/contrast/internal/platforms"
@@ -216,14 +217,14 @@ func PortForwarder(name, namespace string) *PortForwarderConfig {
216217
// WithListenPorts sets multiple ports to listen on.
217218
func (p *PortForwarderConfig) WithListenPorts(ports []int32) *PortForwarderConfig {
218219
var containerPorts []*applycorev1.ContainerPortApplyConfiguration
219-
var envVar string
220+
var envVar strings.Builder
220221
for _, port := range ports {
221222
containerPorts = append(containerPorts, ContainerPort().WithContainerPort(port))
222-
envVar += " " + strconv.Itoa(int(port))
223+
envVar.WriteString(" " + strconv.Itoa(int(port)))
223224
}
224225
p.Spec.Containers[0].
225226
WithPorts(containerPorts...).
226-
WithEnv(NewEnvVar("LISTEN_PORTS", envVar))
227+
WithEnv(NewEnvVar("LISTEN_PORTS", envVar.String()))
227228
return p
228229
}
229230

internal/logger/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func subsystemAllowListMatch(subsystem string, allowList string) bool {
9090
if allowList == "*" {
9191
return true
9292
}
93-
for _, allow := range strings.Split(allowList, ",") {
93+
for allow := range strings.SplitSeq(allowList, ",") {
9494
allow = strings.ToLower(strings.TrimSpace(allow))
9595
if allow == subsystem || allow == "*" {
9696
return true

service-mesh/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func ParseProxyConfig(ingressConfig, egressConfig, adminPort string) (ProxyConfi
120120
return cfg, nil
121121
}
122122

123-
for _, entry := range strings.Split(ingressConfig, "##") {
123+
for entry := range strings.SplitSeq(ingressConfig, "##") {
124124
if entry == "" {
125125
continue
126126
}

tools/tdx-measure/eventlog/mrtd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ func NewMrtdLogger(dir string) *MrtdLogger {
2727

2828
// MemPageAdd logs a TDH_MEM_PAGE_ADD event for the given GPA.
2929
func (l *MrtdLogger) MemPageAdd(gpa uint64) {
30-
l.log([]byte(fmt.Sprintf("TDH_MEM_PAGE_ADD gpa=0x%x\n", gpa)))
30+
l.log(fmt.Appendf(nil, "TDH_MEM_PAGE_ADD gpa=0x%x\n", gpa))
3131
}
3232

3333
// MrExtend logs a TDH_MR_EXTEND event for the given GPA.
3434
func (l *MrtdLogger) MrExtend(gpa uint64) {
35-
l.log([]byte(fmt.Sprintf("TDH_MR_EXTEND gpa=0x%x\n", gpa)))
35+
l.log(fmt.Appendf(nil, "TDH_MR_EXTEND gpa=0x%x\n", gpa))
3636
}
3737

3838
// SaveToFile writes the `TDH_MR_FINALIZE` event and saves the event log

0 commit comments

Comments
 (0)