cloud: fix %v in cases where we should use %w
Change-Id: I161fe87fbc2bf8c4c2c7756074fc1050f268121e
Reviewed-on: https://review.monogon.dev/c/monogon/+/3099
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/cloud/agent/hwreport.go b/cloud/agent/hwreport.go
index 31ccef4..33a7149 100644
--- a/cloud/agent/hwreport.go
+++ b/cloud/agent/hwreport.go
@@ -129,15 +129,15 @@
cpu.Vendor = scannedVals["vendor_id"]
family, err := strconv.Atoi(scannedVals["cpu family"])
if err != nil {
- return fmt.Errorf("unable to parse CPU family to int: %v", err)
+ return fmt.Errorf("unable to parse CPU family to int: %w", err)
}
model, err := strconv.Atoi(scannedVals["model"])
if err != nil {
- return fmt.Errorf("unable to parse CPU model to int: %v", err)
+ return fmt.Errorf("unable to parse CPU model to int: %w", err)
}
stepping, err := strconv.Atoi(scannedVals["stepping"])
if err != nil {
- return fmt.Errorf("unable to parse CPU stepping to int: %v", err)
+ return fmt.Errorf("unable to parse CPU stepping to int: %w", err)
}
cpu.Architecture = &api.CPU_X86_64_{
X86_64: &api.CPU_X86_64{
diff --git a/cloud/agent/install.go b/cloud/agent/install.go
index 5b0c209..126d365 100644
--- a/cloud/agent/install.go
+++ b/cloud/agent/install.go
@@ -74,7 +74,7 @@
bundleRes, err := http.Get(req.BundleUrl)
if err != nil {
l.Warningf("Metropolis bundle request failed: %v", err)
- return fmt.Errorf("HTTP request failed: %v", err)
+ return fmt.Errorf("HTTP request failed: %w", err)
}
defer bundleRes.Body.Close()
switch bundleRes.StatusCode {
@@ -103,7 +103,7 @@
return nil
}, b)
if err != nil {
- return fmt.Errorf("error downloading Metropolis bundle: %v", err)
+ return fmt.Errorf("error downloading Metropolis bundle: %w", err)
}
l.Info("Metropolis Bundle downloaded")
bundle, err := zip.NewReader(bytes.NewReader(bundleRaw.Bytes()), int64(bundleRaw.Len()))
diff --git a/cloud/agent/takeover/takeover.go b/cloud/agent/takeover/takeover.go
index 094c688..645b27e 100644
--- a/cloud/agent/takeover/takeover.go
+++ b/cloud/agent/takeover/takeover.go
@@ -120,7 +120,7 @@
}
agentInitRaw, err := proto.Marshal(&agentInit)
if err != nil {
- return nil, fmt.Errorf("unable to marshal AgentInit message: %v", err)
+ return nil, fmt.Errorf("unable to marshal AgentInit message: %w", err)
}
// Append AgentInit spec to initramfs