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/shepherd/manager/fake_ssh_client.go b/cloud/shepherd/manager/fake_ssh_client.go
index db13b5b..cc8c42a 100644
--- a/cloud/shepherd/manager/fake_ssh_client.go
+++ b/cloud/shepherd/manager/fake_ssh_client.go
@@ -28,13 +28,13 @@
func (f *fakeSSHConnection) Execute(ctx context.Context, command string, stdin []byte) (stdout []byte, stderr []byte, err error) {
var aim apb.TakeoverInit
if err := proto.Unmarshal(stdin, &aim); err != nil {
- return nil, nil, fmt.Errorf("while unmarshaling TakeoverInit message: %v", err)
+ return nil, nil, fmt.Errorf("while unmarshaling TakeoverInit message: %w", err)
}
// Agent should send back apb.TakeoverResponse on its standard output.
pub, _, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
- return nil, nil, fmt.Errorf("while generating agent public key: %v", err)
+ return nil, nil, fmt.Errorf("while generating agent public key: %w", err)
}
arsp := apb.TakeoverResponse{
Result: &apb.TakeoverResponse_Success{Success: &apb.TakeoverSuccess{
@@ -44,7 +44,7 @@
}
arspb, err := proto.Marshal(&arsp)
if err != nil {
- return nil, nil, fmt.Errorf("while marshaling TakeoverResponse message: %v", err)
+ return nil, nil, fmt.Errorf("while marshaling TakeoverResponse message: %w", err)
}
return arspb, nil, nil
}
diff --git a/cloud/shepherd/manager/initializer.go b/cloud/shepherd/manager/initializer.go
index a380a8f..1961fe2 100644
--- a/cloud/shepherd/manager/initializer.go
+++ b/cloud/shepherd/manager/initializer.go
@@ -169,7 +169,7 @@
func (i *Initializer) processMachine(ctx context.Context, t *task) error {
machine, err := i.p.GetMachine(ctx, shepherd.ProviderID(t.machine.ProviderID))
if err != nil {
- return fmt.Errorf("while fetching machine %q: %v", t.machine.ProviderID, err)
+ return fmt.Errorf("while fetching machine %q: %w", t.machine.ProviderID, err)
}
// Start the agent.