Skip to content

Commit 3b169b7

Browse files
authored
Merge pull request #107 from pjbgf/iofs
Bump module to v6
2 parents 18f8786 + 080024b commit 3b169b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+134
-116
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# go-billy [![GoDoc](https://godoc.org/gopkg.in/go-git/go-billy.v5?status.svg)](https://pkg.go.dev/github.com/go-git/go-billy/v5) [![Test](https://github.com/go-git/go-billy/workflows/Test/badge.svg)](https://github.com/go-git/go-billy/actions?query=workflow%3ATest)
1+
# go-billy [![GoDoc](https://godoc.org/gopkg.in/go-git/go-billy.v6?status.svg)](https://pkg.go.dev/github.com/go-git/go-billy/v6) [![Test](https://github.com/go-git/go-billy/workflows/Test/badge.svg)](https://github.com/go-git/go-billy/actions?query=workflow%3ATest)
22

33
The missing interface filesystem abstraction for Go.
44
Billy implements an interface based on the `os` standard library, allowing to develop applications without dependency on the underlying storage. Makes it virtually free to implement mocks and testing over filesystem operations.
@@ -8,14 +8,14 @@ Billy was born as part of [go-git/go-git](https://github.com/go-git/go-git) proj
88
## Installation
99

1010
```go
11-
import "github.com/go-git/go-billy/v5" // with go modules enabled (GO111MODULE=on or outside GOPATH)
11+
import "github.com/go-git/go-billy/v6" // with go modules enabled (GO111MODULE=on or outside GOPATH)
1212
import "github.com/go-git/go-billy" // with go modules disabled
1313
```
1414

1515
## Usage
1616

1717
Billy exposes filesystems using the
18-
[`Filesystem` interface](https://pkg.go.dev/github.com/go-git/go-billy/v5?tab=doc#Filesystem).
18+
[`Filesystem` interface](https://pkg.go.dev/github.com/go-git/go-billy/v6?tab=doc#Filesystem).
1919
Each filesystem implementation gives you a `New` method, whose arguments depend on
2020
the implementation itself, that returns a new `Filesystem`.
2121

fs.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package billy
33
import (
44
"errors"
55
"io"
6-
"os"
6+
"io/fs"
77
"time"
88
)
99

@@ -72,9 +72,9 @@ type Basic interface {
7272
// instead. It opens the named file with specified flag (O_RDONLY etc.) and
7373
// perm, (0666 etc.) if applicable. If successful, methods on the returned
7474
// File can be used for I/O.
75-
OpenFile(filename string, flag int, perm os.FileMode) (File, error)
75+
OpenFile(filename string, flag int, perm fs.FileMode) (File, error)
7676
// Stat returns a FileInfo describing the named file.
77-
Stat(filename string) (os.FileInfo, error)
77+
Stat(filename string) (fs.FileInfo, error)
7878
// Rename renames (moves) oldpath to newpath. If newpath already exists and
7979
// is not a directory, Rename replaces it. OS-specific restrictions may
8080
// apply when oldpath and newpath are in different directories.
@@ -105,12 +105,12 @@ type TempFile interface {
105105
type Dir interface {
106106
// ReadDir reads the directory named by dirname and returns a list of
107107
// directory entries sorted by filename.
108-
ReadDir(path string) ([]os.FileInfo, error)
108+
ReadDir(path string) ([]fs.FileInfo, error)
109109
// MkdirAll creates a directory named path, along with any necessary
110110
// parents, and returns nil, or else returns an error. The permission bits
111111
// perm are used for all directories that MkdirAll creates. If path is/
112112
// already a directory, MkdirAll does nothing and returns nil.
113-
MkdirAll(filename string, perm os.FileMode) error
113+
MkdirAll(filename string, perm fs.FileMode) error
114114
}
115115

116116
// Symlink abstract the symlink related operations in a storage-agnostic
@@ -119,7 +119,7 @@ type Symlink interface {
119119
// Lstat returns a FileInfo describing the named file. If the file is a
120120
// symbolic link, the returned FileInfo describes the symbolic link. Lstat
121121
// makes no attempt to follow the link.
122-
Lstat(filename string) (os.FileInfo, error)
122+
Lstat(filename string) (fs.FileInfo, error)
123123
// Symlink creates a symbolic-link from link to target. target may be an
124124
// absolute or relative path, and need not refer to an existing node.
125125
// Parent directories of link are created as necessary.
@@ -133,7 +133,7 @@ type Symlink interface {
133133
type Change interface {
134134
// Chmod changes the mode of the named file to mode. If the file is a
135135
// symbolic link, it changes the mode of the link's target.
136-
Chmod(name string, mode os.FileMode) error
136+
Chmod(name string, mode fs.FileMode) error
137137
// Lchown changes the numeric uid and gid of the named file. If the file is
138138
// a symbolic link, it changes the uid and gid of the link itself.
139139
Lchown(name string, uid, gid int) error
@@ -161,15 +161,14 @@ type Chroot interface {
161161

162162
// File represent a file, being a subset of the os.File
163163
type File interface {
164+
fs.File
165+
164166
// Name returns the name of the file as presented to Open.
165167
Name() string
166168
io.Writer
167-
// TODO: Add io.WriterAt for v6
168-
// io.WriterAt
169-
io.Reader
169+
io.WriterAt
170170
io.ReaderAt
171171
io.Seeker
172-
io.Closer
173172
// Lock locks the file like e.g. flock. It protects against access from
174173
// other processes.
175174
Lock() error

fs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package billy_test
33
import (
44
"testing"
55

6-
. "github.com/go-git/go-billy/v5"
7-
"github.com/go-git/go-billy/v5/internal/test"
6+
. "github.com/go-git/go-billy/v6"
7+
"github.com/go-git/go-billy/v6/internal/test"
88
"github.com/stretchr/testify/assert"
99
)
1010

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/go-git/go-billy/v5
1+
module github.com/go-git/go-billy/v6
22

33
// go-git supports the last 3 stable Go versions.
44
go 1.21

helper/chroot/chroot.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package chroot
22

33
import (
4+
"io/fs"
45
"os"
56
"path/filepath"
67
"strings"
78

8-
"github.com/go-git/go-billy/v5"
9-
"github.com/go-git/go-billy/v5/helper/polyfill"
9+
"github.com/go-git/go-billy/v6"
10+
"github.com/go-git/go-billy/v6/helper/polyfill"
1011
)
1112

1213
// ChrootHelper is a helper to implement billy.Chroot.
@@ -68,7 +69,7 @@ func (fs *ChrootHelper) Open(filename string) (billy.File, error) {
6869
return newFile(fs, f, filename), nil
6970
}
7071

71-
func (fs *ChrootHelper) OpenFile(filename string, flag int, mode os.FileMode) (billy.File, error) {
72+
func (fs *ChrootHelper) OpenFile(filename string, flag int, mode fs.FileMode) (billy.File, error) {
7273
fullpath, err := fs.underlyingPath(filename)
7374
if err != nil {
7475
return nil, err
@@ -142,7 +143,7 @@ func (fs *ChrootHelper) ReadDir(path string) ([]os.FileInfo, error) {
142143
return fs.underlying.(billy.Dir).ReadDir(fullpath)
143144
}
144145

145-
func (fs *ChrootHelper) MkdirAll(filename string, perm os.FileMode) error {
146+
func (fs *ChrootHelper) MkdirAll(filename string, perm fs.FileMode) error {
146147
fullpath, err := fs.underlyingPath(filename)
147148
if err != nil {
148149
return err

helper/chroot/chroot_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"path/filepath"
66
"testing"
77

8-
"github.com/go-git/go-billy/v5"
9-
"github.com/go-git/go-billy/v5/internal/test"
8+
"github.com/go-git/go-billy/v6"
9+
"github.com/go-git/go-billy/v6/internal/test"
1010
"github.com/stretchr/testify/assert"
1111
)
1212

helper/iofs/iofs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"io/fs"
88
"path/filepath"
99

10-
billyfs "github.com/go-git/go-billy/v5"
11-
"github.com/go-git/go-billy/v5/helper/polyfill"
10+
billyfs "github.com/go-git/go-billy/v6"
11+
"github.com/go-git/go-billy/v6/helper/polyfill"
1212
)
1313

1414
// Wrap adapts a billy.Filesystem to a io.fs.FS.

helper/iofs/iofs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"testing"
1010
"testing/fstest"
1111

12-
billyfs "github.com/go-git/go-billy/v5"
13-
"github.com/go-git/go-billy/v5/memfs"
12+
billyfs "github.com/go-git/go-billy/v6"
13+
"github.com/go-git/go-billy/v6/memfs"
1414
)
1515

1616
type errorList interface {

helper/mount/mount.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package mount
22

33
import (
44
"io"
5+
"io/fs"
56
"os"
67
"path/filepath"
78
"strings"
89

910
"fmt"
1011

11-
"github.com/go-git/go-billy/v5"
12-
"github.com/go-git/go-billy/v5/helper/polyfill"
12+
"github.com/go-git/go-billy/v6"
13+
"github.com/go-git/go-billy/v6/helper/polyfill"
1314
)
1415

1516
var separator = string(filepath.Separator)
@@ -53,7 +54,7 @@ func (h *Mount) Open(path string) (billy.File, error) {
5354
return wrapFile(f, path), err
5455
}
5556

56-
func (h *Mount) OpenFile(path string, flag int, mode os.FileMode) (billy.File, error) {
57+
func (h *Mount) OpenFile(path string, flag int, mode fs.FileMode) (billy.File, error) {
5758
fs, fullpath := h.getBasicAndPath(path)
5859
if fullpath == "." {
5960
return nil, os.ErrInvalid
@@ -118,7 +119,7 @@ func (h *Mount) ReadDir(path string) ([]os.FileInfo, error) {
118119
return fs.ReadDir(fullpath)
119120
}
120121

121-
func (h *Mount) MkdirAll(filename string, perm os.FileMode) error {
122+
func (h *Mount) MkdirAll(filename string, perm fs.FileMode) error {
122123
fs, fullpath, err := h.getDirAndPath(filename)
123124
if err != nil {
124125
return err

helper/mount/mount_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"path/filepath"
66
"testing"
77

8-
"github.com/go-git/go-billy/v5"
9-
"github.com/go-git/go-billy/v5/internal/test"
10-
"github.com/go-git/go-billy/v5/memfs"
11-
"github.com/go-git/go-billy/v5/util"
8+
"github.com/go-git/go-billy/v6"
9+
"github.com/go-git/go-billy/v6/internal/test"
10+
"github.com/go-git/go-billy/v6/memfs"
11+
"github.com/go-git/go-billy/v6/util"
1212
"github.com/stretchr/testify/assert"
1313
)
1414

0 commit comments

Comments
 (0)