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:
1 parent
ec0297fd23
commit
a6fda8f8d3
25 files changed
+929
-41
No files matched your search
@@ -28,9 +28,11 @@ func (r Rsync) args(src, dst string) []string {
|
||||
a := []string{"-aHAXS", "--numeric-ids", "--checksum", "--no-whole-file",
|
||||
"--delete-during", "--partial", "--fsync", "--one-file-system",
|
||||
"--filter=- .snap/", "--filter=-x ceph.*", "--filter=-x system.*"}
|
||||
|
||||
if r.BandwidthKiB > 0 {
|
||||
a = append(a, "--bwlimit="+strconv.FormatInt(r.BandwidthKiB, 10))
|
||||
}
|
||||
|
||||
return append(a, "--", src+"/", dst+"/")
|
||||
}
|
||||
|
||||
@@ -47,16 +49,22 @@ func (r Rsync) Copy(ctx context.Context, src, dst string) error {
|
||||
if r.Log != nil {
|
||||
fmt.Fprintln(r.Log, "rsync hardlink EEXIST: retrying once before snapshot verification")
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return errors.New("rsync retry limit reached")
|
||||
}
|
||||
|
||||
type differences struct{ n int64 }
|
||||
|
||||
func (d *differences) Write(p []byte) (int, error) { d.n += int64(len(p)); return len(p), nil }
|
||||
func (d *differences) Write(p []byte) (int, error) {
|
||||
d.n += int64(len(p))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// Verify runs rsync as a dry run and fails if any difference remains.
|
||||
func (r Rsync) Verify(ctx context.Context, src, dst string) error {
|
||||
@@ -65,8 +73,10 @@ func (r Rsync) Verify(ctx context.Context, src, dst string) error {
|
||||
if err := r.Exec.Exec(ctx, &d, "rsync", args...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if d.n != 0 {
|
||||
return fmt.Errorf("verification found differences between %s and %s", src, dst)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user