From 1707ad0dd87d7ed90c0c2acedc4d207494a91e8e Mon Sep 17 00:00:00 2001 From: re Date: Mon, 12 Dec 2022 18:01:24 +0300 Subject: [PATCH] fix repos --- README.md | 12 ++++++------ afero_test.go | 27 ++++++++++++++------------- copyOnWriteFs_test.go | 12 ++++++------ gcsfs/gcs.go | 14 +++++++++++++- gcsfs/gcs_mocks.go | 4 ++-- gcsfs/gcs_test.go | 28 ++++++++++++++-------------- go.mod | 2 +- iofs.go | 2 +- iofs_test.go | 15 ++++----------- mem/file.go | 9 ++++++--- mem/file_test.go | 12 ++++++------ memmap.go | 8 ++++---- sftpfs/sftp.go | 2 +- tarfs/file.go | 2 +- tarfs/fs.go | 2 +- tarfs/tarfs_test.go | 8 ++++---- zipfs/file.go | 2 +- zipfs/fs.go | 2 +- zipfs/zipfs_test.go | 4 ++-- 19 files changed, 88 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 3bafbfd..7ea84f9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A FileSystem Abstraction System for Go -[![Test](https://github.com/spf13/afero/actions/workflows/test.yml/badge.svg)](https://github.com/spf13/afero/actions/workflows/test.yml) [![GoDoc](https://godoc.org/github.com/spf13/afero?status.svg)](https://godoc.org/github.com/spf13/afero) [![Join the chat at https://gitter.im/spf13/afero](https://badges.gitter.im/Dev%20Chat.svg)](https://gitter.im/spf13/afero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Test](https://git.internal/re/afero/actions/workflows/test.yml/badge.svg)](https://git.internal/re/afero/actions/workflows/test.yml) [![GoDoc](https://godoc.org/git.internal/re/afero?status.svg)](https://godoc.org/git.internal/re/afero) [![Join the chat at https://gitter.im/spf13/afero](https://badges.gitter.im/Dev%20Chat.svg)](https://gitter.im/spf13/afero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) # Overview @@ -50,11 +50,11 @@ A few different ways you could use Afero: First use go get to install the latest version of the library. - $ go get github.com/spf13/afero + $ go get git.internal/re/afero Next include Afero in your application. ```go -import "github.com/spf13/afero" +import "git.internal/re/afero" ``` ## Step 2: Declare a backend @@ -152,7 +152,7 @@ Walk(root string, walkFn filepath.WalkFunc) error WriteFile(filename string, data []byte, perm os.FileMode) error WriteReader(path string, r io.Reader) (err error) ``` -For a complete list see [Afero's GoDoc](https://godoc.org/github.com/spf13/afero) +For a complete list see [Afero's GoDoc](https://godoc.org/git.internal/re/afero) They are available under two different approaches to use. You can either call them directly where the first parameter of each function will be the file @@ -417,7 +417,7 @@ Googles very well. ## Release Notes -See the [Releases Page](https://github.com/spf13/afero/releases). +See the [Releases Page](https://git.internal/re/afero/releases). ## Contributing @@ -439,4 +439,4 @@ Names in no particular order: ## License Afero is released under the Apache 2.0 license. See -[LICENSE.txt](https://github.com/spf13/afero/blob/master/LICENSE.txt) +[LICENSE.txt](https://git.internal/re/afero/blob/master/LICENSE.txt) diff --git a/afero_test.go b/afero_test.go index f875ae1..d8f7d93 100644 --- a/afero_test.go +++ b/afero_test.go @@ -28,8 +28,10 @@ import ( "testing" ) -var testName = "test.txt" -var Fss = []Fs{&MemMapFs{}, &OsFs{}} +var ( + testName = "test.txt" + Fss = []Fs{&MemMapFs{}, &OsFs{}} +) var testRegistry map[Fs][]string = make(map[Fs][]string) @@ -45,7 +47,6 @@ func testDir(fs Fs) string { func tmpFile(fs Fs) File { x, err := TempFile(fs, "", "afero") - if err != nil { panic(fmt.Sprint("unable to work with temp file", err)) } @@ -55,7 +56,7 @@ func tmpFile(fs Fs) File { return x } -//Read with length 0 should not return EOF. +// Read with length 0 should not return EOF. func TestRead0(t *testing.T) { for _, fs := range Fss { f := tmpFile(fs) @@ -83,7 +84,7 @@ func TestOpenFile(t *testing.T) { tmp := testDir(fs) path := filepath.Join(tmp, testName) - f, err := fs.OpenFile(path, os.O_RDWR|os.O_CREATE, 0600) + f, err := fs.OpenFile(path, os.O_RDWR|os.O_CREATE, 0o600) if err != nil { t.Error(fs.Name(), "OpenFile (O_CREATE) failed:", err) continue @@ -91,7 +92,7 @@ func TestOpenFile(t *testing.T) { io.WriteString(f, "initial") f.Close() - f, err = fs.OpenFile(path, os.O_WRONLY|os.O_APPEND, 0600) + f, err = fs.OpenFile(path, os.O_WRONLY|os.O_APPEND, 0o600) if err != nil { t.Error(fs.Name(), "OpenFile (O_APPEND) failed:", err) continue @@ -99,7 +100,7 @@ func TestOpenFile(t *testing.T) { io.WriteString(f, "|append") f.Close() - f, _ = fs.OpenFile(path, os.O_RDONLY, 0600) + f, _ = fs.OpenFile(path, os.O_RDONLY, 0o600) contents, _ := ioutil.ReadAll(f) expectedContents := "initial|append" if string(contents) != expectedContents { @@ -107,7 +108,7 @@ func TestOpenFile(t *testing.T) { } f.Close() - f, err = fs.OpenFile(path, os.O_RDWR|os.O_TRUNC, 0600) + f, err = fs.OpenFile(path, os.O_RDWR|os.O_TRUNC, 0o600) if err != nil { t.Error(fs.Name(), "OpenFile (O_TRUNC) failed:", err) continue @@ -333,7 +334,7 @@ func TestSeek(t *testing.T) { whence int out int64 } - var tests = []test{ + tests := []test{ {0, 1, int64(len(data))}, {0, 0, 0}, {5, 0, 5}, @@ -424,7 +425,7 @@ func setupTestDirReusePath(t *testing.T, fs Fs, path string) string { func setupTestFiles(t *testing.T, fs Fs, path string) string { testSubDir := filepath.Join(path, "more", "subdirectories", "for", "testing", "we") - err := fs.MkdirAll(testSubDir, 0700) + err := fs.MkdirAll(testSubDir, 0o700) if err != nil && !os.IsExist(err) { t.Fatal(err) } @@ -592,7 +593,7 @@ func TestReaddir(t *testing.T) { } } -// https://github.com/spf13/afero/issues/169 +// https://git.internal/re/afero/issues/169 func TestReaddirRegularFile(t *testing.T) { defer removeAllTestFiles(t) for _, fs := range Fss { @@ -637,7 +638,7 @@ func TestReaddirAll(t *testing.T) { if err != nil { t.Fatal(err) } - var namesRoot = []string{} + namesRoot := []string{} for _, e := range rootInfo { namesRoot = append(namesRoot, e.Name()) } @@ -652,7 +653,7 @@ func TestReaddirAll(t *testing.T) { if err != nil { t.Fatal(err) } - var namesSub = []string{} + namesSub := []string{} for _, e := range subInfo { namesSub = append(namesSub, e.Name()) } diff --git a/copyOnWriteFs_test.go b/copyOnWriteFs_test.go index 94ba725..24b2bb1 100644 --- a/copyOnWriteFs_test.go +++ b/copyOnWriteFs_test.go @@ -16,9 +16,9 @@ func TestCopyOnWrite(t *testing.T) { compositeFs := NewCopyOnWriteFs(NewReadOnlyFs(NewOsFs()), osFs) - var dir = filepath.Join(writeDir, "some/path") + dir := filepath.Join(writeDir, "some/path") - err = compositeFs.MkdirAll(dir, 0744) + err = compositeFs.MkdirAll(dir, 0o744) if err != nil { t.Fatal(err) } @@ -27,17 +27,17 @@ func TestCopyOnWrite(t *testing.T) { t.Fatal(err) } - // https://github.com/spf13/afero/issues/189 + // https://git.internal/re/afero/issues/189 // We want the composite file system to behave like the OS file system // on Mkdir and MkdirAll for _, fs := range []Fs{osFs, compositeFs} { - err = fs.Mkdir(dir, 0744) + err = fs.Mkdir(dir, 0o744) if err == nil || !os.IsExist(err) { t.Errorf("Mkdir: Got %q for %T", err, fs) } // MkdirAll does not return an error when the directory already exists - err = fs.MkdirAll(dir, 0744) + err = fs.MkdirAll(dir, 0o744) if err != nil { t.Errorf("MkdirAll: Got %q for %T", err, fs) } @@ -49,7 +49,7 @@ func TestCopyOnWriteFileInMemMapBase(t *testing.T) { base := &MemMapFs{} layer := &MemMapFs{} - if err := WriteFile(base, "base.txt", []byte("base"), 0755); err != nil { + if err := WriteFile(base, "base.txt", []byte("base"), 0o755); err != nil { t.Fatalf("Failed to write file: %s", err) } diff --git a/gcsfs/gcs.go b/gcsfs/gcs.go index 78cc924..b12331d 100644 --- a/gcsfs/gcs.go +++ b/gcsfs/gcs.go @@ -22,8 +22,8 @@ import ( "time" "cloud.google.com/go/storage" + "git.internal/re/afero" "github.com/googleapis/google-cloud-go-testing/storage/stiface" - "github.com/spf13/afero" "google.golang.org/api/option" ) @@ -76,39 +76,51 @@ func NewGcsFSFromClientWithSeparator(ctx context.Context, client *storage.Client func (fs *GcsFs) Name() string { return fs.source.Name() } + func (fs *GcsFs) Create(name string) (afero.File, error) { return fs.source.Create(name) } + func (fs *GcsFs) Mkdir(name string, perm os.FileMode) error { return fs.source.Mkdir(name, perm) } + func (fs *GcsFs) MkdirAll(path string, perm os.FileMode) error { return fs.source.MkdirAll(path, perm) } + func (fs *GcsFs) Open(name string) (afero.File, error) { return fs.source.Open(name) } + func (fs *GcsFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) { return fs.source.OpenFile(name, flag, perm) } + func (fs *GcsFs) Remove(name string) error { return fs.source.Remove(name) } + func (fs *GcsFs) RemoveAll(path string) error { return fs.source.RemoveAll(path) } + func (fs *GcsFs) Rename(oldname, newname string) error { return fs.source.Rename(oldname, newname) } + func (fs *GcsFs) Stat(name string) (os.FileInfo, error) { return fs.source.Stat(name) } + func (fs *GcsFs) Chmod(name string, mode os.FileMode) error { return fs.source.Chmod(name, mode) } + func (fs *GcsFs) Chtimes(name string, atime time.Time, mtime time.Time) error { return fs.source.Chtimes(name, atime, mtime) } + func (fs *GcsFs) Chown(name string, uid, gid int) error { return fs.source.Chown(name, uid, gid) } diff --git a/gcsfs/gcs_mocks.go b/gcsfs/gcs_mocks.go index 272eb9f..7682330 100644 --- a/gcsfs/gcs_mocks.go +++ b/gcsfs/gcs_mocks.go @@ -18,8 +18,8 @@ import ( "strings" "cloud.google.com/go/storage" + "git.internal/re/afero" "github.com/googleapis/google-cloud-go-testing/storage/stiface" - "github.com/spf13/afero" "google.golang.org/api/iterator" ) @@ -166,7 +166,7 @@ func (w *writerMock) Close() error { if w.file == nil { var err error if strings.HasSuffix(w.name, "/") { - err = w.fs.Mkdir(w.name, 0755) + err = w.fs.Mkdir(w.name, 0o755) if err != nil { return err } diff --git a/gcsfs/gcs_test.go b/gcsfs/gcs_test.go index feedfb0..1658fa1 100644 --- a/gcsfs/gcs_test.go +++ b/gcsfs/gcs_test.go @@ -20,8 +20,8 @@ import ( "golang.org/x/oauth2/google" "cloud.google.com/go/storage" + "git.internal/re/afero" "github.com/googleapis/google-cloud-go-testing/storage/stiface" - "github.com/spf13/afero" ) const ( @@ -122,7 +122,7 @@ func TestMain(m *testing.M) { gcsAfs = &afero.Afero{Fs: &GcsFs{NewGcsFs(ctx, mockClient)}} // Uncomment to use the real, not mocked, client - //gcsAfs = &Afero{Fs: &GcsFs{gcsfs.NewGcsFs(ctx, client)}} + // gcsAfs = &Afero{Fs: &GcsFs{gcsfs.NewGcsFs(ctx, client)}} exitCode = m.Run() } @@ -341,7 +341,7 @@ func TestGcsSeek(t *testing.T) { t.Fatalf("opening %v: %v", name, err) } - var tests = []struct { + tests := []struct { offIn int64 whence int offOut int64 @@ -477,7 +477,7 @@ func TestGcsOpenFile(t *testing.T) { } for _, name := range names { - file, err := gcsAfs.OpenFile(name, os.O_RDONLY, 0400) + file, err := gcsAfs.OpenFile(name, os.O_RDONLY, 0o400) if !f.exists { if (f.name != "" && !errors.Is(err, syscall.ENOENT)) || (f.name == "" && !errors.Is(err, ErrNoBucketInName)) { @@ -496,7 +496,7 @@ func TestGcsOpenFile(t *testing.T) { t.Fatalf("failed to close a file \"%s\": %s", name, err) } - _, err = gcsAfs.OpenFile(name, os.O_CREATE, 0600) + _, err = gcsAfs.OpenFile(name, os.O_CREATE, 0o600) if !errors.Is(err, syscall.EPERM) { t.Errorf("%v: open for write: got %v, expected %v", name, err, syscall.EPERM) } @@ -714,7 +714,7 @@ func TestGcsMkdir(t *testing.T) { t.Run("empty", func(t *testing.T) { emptyDirName := bucketName - err := gcsAfs.Mkdir(emptyDirName, 0755) + err := gcsAfs.Mkdir(emptyDirName, 0o755) if err == nil { t.Fatal("did not fail upon creation of an empty folder") } @@ -723,7 +723,7 @@ func TestGcsMkdir(t *testing.T) { dirName := filepath.Join(bucketName, "a-test-dir") var err error - err = gcsAfs.Mkdir(dirName, 0755) + err = gcsAfs.Mkdir(dirName, 0o755) if err != nil { t.Fatal("failed to create a folder with error", err) } @@ -739,7 +739,7 @@ func TestGcsMkdir(t *testing.T) { t.Errorf("%s: mode is not directory", dirName) } - if info.Mode() != os.ModeDir|0755 { + if info.Mode() != os.ModeDir|0o755 { t.Errorf("%s: wrong permissions, expected drwxr-xr-x, got %s", dirName, info.Mode()) } @@ -754,7 +754,7 @@ func TestGcsMkdirAll(t *testing.T) { t.Run("empty", func(t *testing.T) { emptyDirName := bucketName - err := gcsAfs.MkdirAll(emptyDirName, 0755) + err := gcsAfs.MkdirAll(emptyDirName, 0o755) if err == nil { t.Fatal("did not fail upon creation of an empty folder") } @@ -762,7 +762,7 @@ func TestGcsMkdirAll(t *testing.T) { t.Run("success", func(t *testing.T) { dirName := filepath.Join(bucketName, "a/b/c") - err := gcsAfs.MkdirAll(dirName, 0755) + err := gcsAfs.MkdirAll(dirName, 0o755) if err != nil { t.Fatal(err) } @@ -774,7 +774,7 @@ func TestGcsMkdirAll(t *testing.T) { if !info.Mode().IsDir() { t.Errorf("%s: mode is not directory", filepath.Join(bucketName, "a")) } - if info.Mode() != os.ModeDir|0755 { + if info.Mode() != os.ModeDir|0o755 { t.Errorf("%s: wrong permissions, expected drwxr-xr-x, got %s", filepath.Join(bucketName, "a"), info.Mode()) } info, err = gcsAfs.Stat(filepath.Join(bucketName, "a/b")) @@ -784,7 +784,7 @@ func TestGcsMkdirAll(t *testing.T) { if !info.Mode().IsDir() { t.Errorf("%s: mode is not directory", filepath.Join(bucketName, "a/b")) } - if info.Mode() != os.ModeDir|0755 { + if info.Mode() != os.ModeDir|0o755 { t.Errorf("%s: wrong permissions, expected drwxr-xr-x, got %s", filepath.Join(bucketName, "a/b"), info.Mode()) } info, err = gcsAfs.Stat(dirName) @@ -794,7 +794,7 @@ func TestGcsMkdirAll(t *testing.T) { if !info.Mode().IsDir() { t.Errorf("%s: mode is not directory", dirName) } - if info.Mode() != os.ModeDir|0755 { + if info.Mode() != os.ModeDir|0o755 { t.Errorf("%s: wrong permissions, expected drwxr-xr-x, got %s", dirName, info.Mode()) } @@ -816,7 +816,7 @@ func TestGcsRemoveAll(t *testing.T) { aDir := filepath.Join(bucketName, "a") bDir := filepath.Join(aDir, "b") - err := gcsAfs.MkdirAll(bDir, 0755) + err := gcsAfs.MkdirAll(bDir, 0o755) if err != nil { t.Fatal(err) } diff --git a/go.mod b/go.mod index a301a4e..7ff76eb 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/spf13/afero +module git.internal/re/afero require ( cloud.google.com/go/storage v1.14.0 diff --git a/iofs.go b/iofs.go index 938b931..aa67b31 100644 --- a/iofs.go +++ b/iofs.go @@ -11,7 +11,7 @@ import ( "sort" "time" - "github.com/spf13/afero/internal/common" + "git.internal/re/afero/internal/common" ) // IOFS adopts afero.Fs to stdlib io/fs.FS diff --git a/iofs_test.go b/iofs_test.go index 579345e..613cf8a 100644 --- a/iofs_test.go +++ b/iofs_test.go @@ -17,7 +17,7 @@ import ( "testing/fstest" "time" - "github.com/spf13/afero/internal/common" + "git.internal/re/afero/internal/common" ) func TestIOFS(t *testing.T) { @@ -66,7 +66,6 @@ func TestIOFS(t *testing.T) { t.Error(err) } }) - } func TestIOFSNativeDirEntryWhenPossible(t *testing.T) { @@ -145,7 +144,6 @@ func TestIOFSNativeDirEntryWhenPossible(t *testing.T) { } return nil - }) if err != nil { @@ -155,7 +153,6 @@ func TestIOFSNativeDirEntryWhenPossible(t *testing.T) { if fileCount != numFiles { t.Fatalf("expected %d, got %d", numFiles, fileCount) } - } func TestFromIOFS(t *testing.T) { @@ -360,7 +357,6 @@ func TestFromIOFS_File(t *testing.T) { // MapFS files implements io.ReaderAt b := make([]byte, 2) _, err := file.ReadAt(b, 2) - if err != nil { t.Errorf("ReadAt failed: %v", err) return @@ -420,7 +416,7 @@ func TestFromIOFS_File(t *testing.T) { return } - var expectedItems = []struct { + expectedItems := []struct { Name string IsDir bool Size int64 @@ -472,7 +468,7 @@ func TestFromIOFS_File(t *testing.T) { return } - var expectedItems = []string{"dir1", "dir2", "test.txt"} + expectedItems := []string{"dir1", "dir2", "test.txt"} if len(expectedItems) != len(items) { t.Errorf("Items count mismatch, expected %d, got %d", len(expectedItems), len(items)) @@ -530,7 +526,7 @@ func BenchmarkWalkDir(b *testing.B) { dirname := "" for i := 0; i < level; i++ { dirname = filepath.Join(dirname, fmt.Sprintf("dir%d", i)) - err := osfs.MkdirAll(dirname, 0755) + err := osfs.MkdirAll(dirname, 0o755) if err != nil && !os.IsExist(err) { b.Fatal(err) } @@ -547,12 +543,9 @@ func BenchmarkWalkDir(b *testing.B) { return err } return nil - }) - if err != nil { b.Fatal(err) } } - } diff --git a/mem/file.go b/mem/file.go index 3cf4693..6ffab41 100644 --- a/mem/file.go +++ b/mem/file.go @@ -25,7 +25,7 @@ import ( "sync/atomic" "time" - "github.com/spf13/afero/internal/common" + "git.internal/re/afero/internal/common" ) const FilePathSeparator = string(filepath.Separator) @@ -245,7 +245,7 @@ func (f *File) Truncate(size int64) error { defer f.fileData.Unlock() if size > int64(len(f.fileData.data)) { diff := size - int64(len(f.fileData.data)) - f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{00}, int(diff))...) + f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{0o0}, int(diff))...) } else { f.fileData.data = f.fileData.data[0:size] } @@ -285,7 +285,7 @@ func (f *File) Write(b []byte) (n int, err error) { tail = f.fileData.data[n+int(cur):] } if diff > 0 { - f.fileData.data = append(f.fileData.data, append(bytes.Repeat([]byte{00}, int(diff)), b...)...) + f.fileData.data = append(f.fileData.data, append(bytes.Repeat([]byte{0o0}, int(diff)), b...)...) f.fileData.data = append(f.fileData.data, tail...) } else { f.fileData.data = append(f.fileData.data[:cur], b...) @@ -321,16 +321,19 @@ func (s *FileInfo) Name() string { s.Unlock() return name } + func (s *FileInfo) Mode() os.FileMode { s.Lock() defer s.Unlock() return s.mode } + func (s *FileInfo) ModTime() time.Time { s.Lock() defer s.Unlock() return s.modtime } + func (s *FileInfo) IsDir() bool { s.Lock() defer s.Unlock() diff --git a/mem/file_test.go b/mem/file_test.go index 998a5d0..e4b33c6 100644 --- a/mem/file_test.go +++ b/mem/file_test.go @@ -66,8 +66,8 @@ func TestFileDataModTimeRace(t *testing.T) { func TestFileDataModeRace(t *testing.T) { t.Parallel() - const someMode = 0777 - const someOtherMode = 0660 + const someMode = 0o777 + const someOtherMode = 0o660 d := FileData{ mode: someMode, @@ -95,7 +95,7 @@ func TestFileDataModeRace(t *testing.T) { } } -// See https://github.com/spf13/afero/issues/286. +// See https://git.internal/re/afero/issues/286. func TestFileWriteAt(t *testing.T) { t.Parallel() @@ -167,7 +167,7 @@ func TestFileDataIsDirRace(t *testing.T) { s.Unlock() }() - //just logging the value to trigger a read: + // just logging the value to trigger a read: t.Logf("Value is %v", s.IsDir()) } @@ -196,10 +196,10 @@ func TestFileDataSizeRace(t *testing.T) { s.Unlock() }() - //just logging the value to trigger a read: + // just logging the value to trigger a read: t.Logf("Value is %v", s.Size()) - //Testing the Dir size case + // Testing the Dir size case d.dir = true if s.Size() != int64(42) { t.Errorf("Failed to read correct value for dir, was %v", s.Size()) diff --git a/memmap.go b/memmap.go index d06975e..4021ce0 100644 --- a/memmap.go +++ b/memmap.go @@ -22,7 +22,7 @@ import ( "sync" "time" - "github.com/spf13/afero/mem" + "git.internal/re/afero/mem" ) const chmodBits = os.ModePerm | os.ModeSetuid | os.ModeSetgid | os.ModeSticky // Only a subset of bits are allowed to be changed. Documented under os.Chmod() @@ -43,7 +43,7 @@ func (m *MemMapFs) getData() map[string]*mem.FileData { // Root should always exist, right? // TODO: what about windows? root := mem.CreateDir(FilePathSeparator) - mem.SetMode(root, os.ModeDir|0755) + mem.SetMode(root, os.ModeDir|0o755) m.data[FilePathSeparator] = root }) return m.data @@ -96,12 +96,12 @@ func (m *MemMapFs) registerWithParent(f *mem.FileData, perm os.FileMode) { pdir := filepath.Dir(filepath.Clean(f.Name())) err := m.lockfreeMkdir(pdir, perm) if err != nil { - //log.Println("Mkdir error:", err) + // log.Println("Mkdir error:", err) return } parent, err = m.lockfreeOpen(pdir) if err != nil { - //log.Println("Open after Mkdir error:", err) + // log.Println("Open after Mkdir error:", err) return } } diff --git a/sftpfs/sftp.go b/sftpfs/sftp.go index eadf1e0..e77d39c 100644 --- a/sftpfs/sftp.go +++ b/sftpfs/sftp.go @@ -17,8 +17,8 @@ import ( "os" "time" + "git.internal/re/afero" "github.com/pkg/sftp" - "github.com/spf13/afero" ) // Fs is a afero.Fs implementation that uses functions provided by the sftp package. diff --git a/tarfs/file.go b/tarfs/file.go index e1d63ed..cb00e0d 100644 --- a/tarfs/file.go +++ b/tarfs/file.go @@ -8,7 +8,7 @@ import ( "sort" "syscall" - "github.com/spf13/afero" + "git.internal/re/afero" ) type File struct { diff --git a/tarfs/fs.go b/tarfs/fs.go index 0d764e5..5741e5d 100644 --- a/tarfs/fs.go +++ b/tarfs/fs.go @@ -10,7 +10,7 @@ import ( "syscall" "time" - "github.com/spf13/afero" + "git.internal/re/afero" ) type Fs struct { diff --git a/tarfs/tarfs_test.go b/tarfs/tarfs_test.go index aa2d6a4..c89961b 100644 --- a/tarfs/tarfs_test.go +++ b/tarfs/tarfs_test.go @@ -13,7 +13,7 @@ import ( "syscall" "testing" - "github.com/spf13/afero" + "git.internal/re/afero" ) var files = []struct { @@ -161,7 +161,7 @@ func TestSeek(t *testing.T) { t.Fatalf("opening %v: %v", f.name, err) } - var tests = []struct { + tests := []struct { offin int64 whence int offout int64 @@ -252,7 +252,7 @@ func TestClose(t *testing.T) { func TestOpenFile(t *testing.T) { for _, f := range files { - file, err := afs.OpenFile(f.name, os.O_RDONLY, 0400) + file, err := afs.OpenFile(f.name, os.O_RDONLY, 0o400) if !f.exists { if !errors.Is(err, syscall.ENOENT) { t.Errorf("%v: got %v, expected%v", f.name, err, syscall.ENOENT) @@ -266,7 +266,7 @@ func TestOpenFile(t *testing.T) { } file.Close() - _, err = afs.OpenFile(f.name, os.O_CREATE, 0600) + _, err = afs.OpenFile(f.name, os.O_CREATE, 0o600) if !errors.Is(err, syscall.EPERM) { t.Errorf("%v: open for write: got %v, expected %v", f.name, err, syscall.EPERM) } diff --git a/zipfs/file.go b/zipfs/file.go index 9b7ddbe..5bfcabe 100644 --- a/zipfs/file.go +++ b/zipfs/file.go @@ -7,7 +7,7 @@ import ( "path/filepath" "syscall" - "github.com/spf13/afero" + "git.internal/re/afero" ) type File struct { diff --git a/zipfs/fs.go b/zipfs/fs.go index d08b7f5..7fc7476 100644 --- a/zipfs/fs.go +++ b/zipfs/fs.go @@ -7,7 +7,7 @@ import ( "syscall" "time" - "github.com/spf13/afero" + "git.internal/re/afero" ) type Fs struct { diff --git a/zipfs/zipfs_test.go b/zipfs/zipfs_test.go index bf781cc..761a66a 100644 --- a/zipfs/zipfs_test.go +++ b/zipfs/zipfs_test.go @@ -1,12 +1,12 @@ package zipfs import ( - "github.com/spf13/afero" - "archive/zip" "path/filepath" "reflect" "testing" + + "git.internal/re/afero" ) func TestZipFS(t *testing.T) {