style: add blank lines between declarations and statement blocks

Separate top-level declarations and multi-line statements with blank
lines, keeping an "if err != nil" check next to the statement it
belongs to. Expand semicolon one-liners, group the nativeTransport
fields by purpose, and format the cgo preamble as readable C.
Apart from the expanded one-liners and the C preamble, the change
is whitespace only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 18:36:19 +01:00
1 parent ec0297fd23
commit a6fda8f8d3
25 files changed
+929 -41

No files matched your search

+9
View File
@@ -46,9 +46,11 @@ func (b *tailBuffer) Write(p []byte) (int, error) {
b.data = append(b.data[:0], p[n-limit:]...)
return n, nil
}
if len(b.data)+n > limit {
b.data = append(b.data[:0], b.data[len(b.data)+n-limit:]...)
}
b.data = append(b.data, p...)
return n, nil
}
@@ -63,6 +65,7 @@ func (p Process) Exec(ctx context.Context, out io.Writer, name string, args ...s
if p.Stderr != nil {
cmd.Stderr = io.MultiWriter(p.Stderr, &diagnostic)
}
cmd.Env = append(os.Environ(), "LC_ALL=C")
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
cmd.Cancel = func() error {
@@ -70,16 +73,20 @@ func (p Process) Exec(ctx context.Context, out io.Writer, name string, args ...s
if errors.Is(err, syscall.ESRCH) {
return os.ErrProcessDone
}
return err
}
cmd.WaitDelay = 5 * time.Second
if err := cmd.Run(); err != nil {
if ctx.Err() != nil {
return ctx.Err()
}
// Do not print arguments: Ceph metadata values may be confidential.
return &ProcessError{Name: name, Err: err, Diagnostic: strings.TrimSpace(string(diagnostic.data))}
}
return nil
}
@@ -92,6 +99,7 @@ func (b *limitedBuffer) Write(p []byte) (int, error) {
if len(p) > b.limit-b.Len() {
return 0, errors.New("command output exceeds configured limit")
}
return b.Buffer.Write(p)
}
@@ -100,5 +108,6 @@ func output(ctx context.Context, x Executor, name string, args ...string) ([]byt
if err := x.Exec(ctx, b, name, args...); err != nil {
return nil, err
}
return b.Bytes(), nil
}