Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit e568774

Browse files
committed
internal/fs: nits here and there
Signed-off-by: Ibrahim AshShohail <[email protected]>
1 parent f82ed6b commit e568774

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

internal/fs/fs.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func CopyDir(src, dst string) error {
243243
// the copied data is synced/flushed to stable storage.
244244
func copyFile(src, dst string) (err error) {
245245
if sym, err := IsSymlink(src); err != nil {
246-
return errors.Wrapf(err, "could not lstat %s", src)
246+
return err
247247
} else if sym {
248248
err := copySymlink(src, dst)
249249
return err
@@ -296,11 +296,8 @@ func copySymlink(src, dst string) error {
296296
}
297297

298298
err = os.Symlink(resolved, dst)
299-
if err != nil {
300-
return errors.Wrapf(err, "failed to create symlink %s to %s", src, resolved)
301-
}
302299

303-
return nil
300+
return errors.Wrapf(err, "failed to create symlink %s to %s", src, resolved)
304301
}
305302

306303
// IsDir determines is the path given is a directory or not.

internal/fs/fs_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,13 @@ func TestIsEmpty(t *testing.T) {
772772
}
773773

774774
func TestIsSymlink(t *testing.T) {
775+
if runtime.GOOS == "windows" {
776+
// XXX: creating symlinks is not supported in Go on
777+
// Microsoft Windows. Skipping this this until a solution
778+
// for creating symlinks is is provided.
779+
t.Skip("skipping on windows")
780+
}
781+
775782
dir, err := ioutil.TempDir("", "dep")
776783
if err != nil {
777784
t.Fatal(err)
@@ -834,22 +841,15 @@ func TestIsSymlink(t *testing.T) {
834841
}
835842

836843
for path, want := range tests {
837-
if runtime.GOOS == "windows" {
838-
// XXX: setting permissions works differently in
839-
// Microsoft Windows. Skipping this this until a
840-
// compatible implementation is provided.
841-
t.Skip("skipping on windows")
842-
}
843-
844844
got, err := IsSymlink(path)
845845
if err != nil {
846846
if !want.err {
847-
t.Fatalf("expected no error, got %v", err)
847+
t.Errorf("expected no error, got %v", err)
848848
}
849849
}
850850

851851
if got != want.expected {
852-
t.Fatalf("expected %t for %s, got %t", want.expected, path, got)
852+
t.Errorf("expected %t for %s, got %t", want.expected, path, got)
853853
}
854854
}
855855
}

0 commit comments

Comments
 (0)