metropolis/test: fix %v in cases where we should use %w
Change-Id: I3ad73960ad6655332c9d223e13796ca410dca582
Reviewed-on: https://review.monogon.dev/c/monogon/+/3095
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/test/launch/cluster/cluster.go b/metropolis/test/launch/cluster/cluster.go
index b37f5b5..cca77ac 100644
--- a/metropolis/test/launch/cluster/cluster.go
+++ b/metropolis/test/launch/cluster/cluster.go
@@ -200,7 +200,7 @@
for _, n := range c.NodeIDs {
ep, err := resolver.NodeWithDefaultPort(n)
if err != nil {
- return nil, fmt.Errorf("could not add node %q by DNS: %v", n, err)
+ return nil, fmt.Errorf("could not add node %q by DNS: %w", n, err)
}
r.AddEndpoint(ep)
}
@@ -503,7 +503,7 @@
macBuf := make([]byte, 6)
_, err := rand.Read(macBuf)
if err != nil {
- return nil, fmt.Errorf("failed to read randomness for MAC: %v", err)
+ return nil, fmt.Errorf("failed to read randomness for MAC: %w", err)
}
// Set U/L bit and clear I/G bit (locally administered individual MAC)
diff --git a/metropolis/test/nanoswitch/nanoswitch.go b/metropolis/test/nanoswitch/nanoswitch.go
index 0bc65bd..b4ced56 100644
--- a/metropolis/test/nanoswitch/nanoswitch.go
+++ b/metropolis/test/nanoswitch/nanoswitch.go
@@ -187,7 +187,7 @@
Scope: netlink.SCOPE_UNIVERSE,
}
if err := netlink.RouteAdd(route); err != nil {
- return fmt.Errorf("could not add default route: netlink.RouteAdd(%+v): %v", route, err)
+ return fmt.Errorf("could not add default route: netlink.RouteAdd(%+v): %w", route, err)
}
return nil
}
diff --git a/metropolis/test/nanoswitch/socks.go b/metropolis/test/nanoswitch/socks.go
index a85e9a3..b8e7107 100644
--- a/metropolis/test/nanoswitch/socks.go
+++ b/metropolis/test/nanoswitch/socks.go
@@ -64,7 +64,7 @@
func runSOCKSProxy(ctx context.Context) error {
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", SOCKSPort))
if err != nil {
- return fmt.Errorf("failed to listen on :%d : %v", SOCKSPort, err)
+ return fmt.Errorf("failed to listen on :%d : %w", SOCKSPort, err)
}
h := &socksHandler{}