Skip to content

Commit f1c9af8

Browse files
authored
Merge pull request #154 from mikebrow/cleanup-nits
Cleanup gofmt issues; regen Authors; reduce some code complexity in samefile comparison
2 parents cf53015 + f681eac commit f1c9af8

4 files changed

Lines changed: 31 additions & 15 deletions

File tree

AUTHORS

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
Aaron Lehmann <[email protected]>
22
Akash Gupta <[email protected]>
3+
Akihiro Suda <[email protected]>
34
Akihiro Suda <[email protected]>
5+
Akihiro Suda <[email protected]>
46
Andrew Pennebaker <[email protected]>
57
Brandon Philips <[email protected]>
8+
Brian Goff <[email protected]>
69
Christopher Jones <[email protected]>
710
Daniel, Dao Quang Minh <[email protected]>
11+
Darren Stahl <[email protected]>
12+
Derek McGowan <[email protected]>
813
Derek McGowan <[email protected]>
914
Edward Pilatowicz <[email protected]>
1015
Ian Campbell <[email protected]>
16+
Ivan Markin <[email protected]>
1117
Justin Cormack <[email protected]>
1218
Justin Cummins <[email protected]>
19+
Kasper Fabæch Brandt <[email protected]>
20+
Kir Kolyshkin <[email protected]>
21+
Michael Crosby <[email protected]>
22+
Michael Wan <[email protected]>
23+
Niels de Vos <[email protected]>
1324
Phil Estes <[email protected]>
25+
Phil Estes <[email protected]>
26+
Sam Whited <[email protected]>
27+
Shengjing Zhu <[email protected]>
1428
Stephen J Day <[email protected]>
29+
Tibor Vass <[email protected]>
1530
Tobias Klauser <[email protected]>
31+
Tom Faulhaber <[email protected]>
1632
Tonis Tiigi <[email protected]>
33+
Trevor Porter <[email protected]>
34+
35+
Wilbert van de Ridder <[email protected]>
36+
Xiaodong Ye <[email protected]>

fs/copy_linux_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ package fs
2020

2121
import (
2222
"io"
23-
"path/filepath"
24-
"math/rand"
2523
"io/ioutil"
24+
"math/rand"
2625
"os"
2726
"os/exec"
27+
"path/filepath"
2828
"testing"
2929

3030
"github.com/containerd/continuity/testutil"
@@ -59,7 +59,7 @@ func TestCopyReflinkWithXFS(t *testing.T) {
5959
}
6060
unmounted := false
6161
defer func() {
62-
if !unmounted{
62+
if !unmounted {
6363
testutil.Unmount(t, mnt)
6464
}
6565
loop.Close()

fs/path.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,13 @@ func sameFile(f1, f2 *currentPath) (bool, error) {
117117
// If the timestamp may have been truncated in both of the
118118
// files, check content of file to determine difference
119119
if t1.Nanosecond() == 0 && t2.Nanosecond() == 0 {
120-
var eq bool
121120
if (f1.f.Mode() & os.ModeSymlink) == os.ModeSymlink {
122-
eq, err = compareSymlinkTarget(f1.fullPath, f2.fullPath)
123-
} else if f1.f.Size() > 0 {
124-
eq, err = compareFileContent(f1.fullPath, f2.fullPath)
125-
} else {
126-
eq, err = true, nil // if file sizes are zero length, the files are the same by definition
121+
return compareSymlinkTarget(f1.fullPath, f2.fullPath)
127122
}
128-
if err != nil || !eq {
129-
return eq, err
123+
if f1.f.Size() == 0 { // if file sizes are zero length, the files are the same by definition
124+
return true, nil
130125
}
126+
return compareFileContent(f1.fullPath, f2.fullPath)
131127
} else if t1.Nanosecond() != t2.Nanosecond() {
132128
return false, nil
133129
}

testutil/loopback/loopback_linux.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"io/ioutil"
2323
"os"
2424
"os/exec"
25-
"syscall"
2625
"strings"
26+
"syscall"
2727

2828
"github.com/pkg/errors"
2929
"github.com/sirupsen/logrus"
@@ -70,9 +70,9 @@ func New(size int64) (*Loopback, error) {
7070
}
7171

7272
l := Loopback{
73-
File: file.Name(),
73+
File: file.Name(),
7474
Device: deviceName,
75-
close: cleanup,
75+
close: cleanup,
7676
}
7777
return &l, nil
7878
}
@@ -83,7 +83,7 @@ type Loopback struct {
8383
File string
8484
// Device is /dev/loopX
8585
Device string
86-
close func() error
86+
close func() error
8787
}
8888

8989
// SoftSize returns st_size

0 commit comments

Comments
 (0)