Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/onboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cmd

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -31,6 +32,13 @@ import (

type fsVar map[string]string

type errorLog struct{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The name errorLog is a bit generic. Consider renaming it to slogErrorWriter to be more descriptive about its function: acting as an io.Writer that forwards messages to slog.Error. This would improve code clarity and maintainability. You'll need to update the name here and on lines 37 and 299.

Suggested change
type errorLog struct{}
type slogErrorWriter struct{}


func (e errorLog) Write(p []byte) (int, error) {
slog.Error(string(bytes.TrimSpace(p)))
return len(p), nil
}

var (
cipherSuite string
dlDir string
Expand Down Expand Up @@ -288,6 +296,7 @@ func transferOwnership2(transport fdo.Transport, to1d *cose.Sign1[protocol.To1d,
}
return filepath.Join(dlDir, filepath.Base(cleanName))
},
ErrorLog: &errorLog{},
}
}
if echoCmds {
Expand Down
Loading