mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Upgrade doublestar to v2.0.1 (#742)
This commit is contained in:
3
vendor/github.com/bmatcuk/doublestar/go.mod
generated
vendored
3
vendor/github.com/bmatcuk/doublestar/go.mod
generated
vendored
@@ -1,3 +0,0 @@
|
||||
module github.com/bmatcuk/doublestar
|
||||
|
||||
go 1.12
|
||||
@@ -8,6 +8,8 @@ Path pattern matching and globbing supporting `doublestar` (`**`) patterns.
|
||||
|
||||
## About
|
||||
|
||||
#### [Updating from v1 to v2?](UPGRADING.md)
|
||||
|
||||
**doublestar** is a [golang](http://golang.org/) implementation of path pattern
|
||||
matching and globbing with support for "doublestar" (aka globstar: `**`)
|
||||
patterns.
|
||||
@@ -38,13 +40,13 @@ only match directories.
|
||||
**doublestar** can be installed via `go get`:
|
||||
|
||||
```bash
|
||||
go get github.com/bmatcuk/doublestar
|
||||
go get github.com/bmatcuk/doublestar/v2
|
||||
```
|
||||
|
||||
To use it in your code, you must import it:
|
||||
|
||||
```go
|
||||
import "github.com/bmatcuk/doublestar"
|
||||
import "github.com/bmatcuk/doublestar/v2"
|
||||
```
|
||||
|
||||
## Usage
|
||||
13
vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md
generated
vendored
Normal file
13
vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Upgrading from v1 to v2
|
||||
|
||||
The change from v1 to v2 was fairly minor: the return type of the `Open` method
|
||||
on the `OS` interface was changed from `*os.File` to `File`, a new interface
|
||||
exported by doublestar. The new `File` interface only defines the functionality
|
||||
doublestar actually needs (`io.Closer` and `Readdir`), making it easier to use
|
||||
doublestar with [go-billy](https://github.com/src-d/go-billy),
|
||||
[afero](https://github.com/spf13/afero), or something similar. If you were
|
||||
using this functionality, updating should be as easy as updating `Open's`
|
||||
return type, since `os.File` already implements `doublestar.File`.
|
||||
|
||||
If you weren't using this functionality, updating should be as easy as changing
|
||||
your dependencies to point to v2.
|
||||
@@ -2,6 +2,7 @@ package doublestar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -10,27 +11,33 @@ import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// File defines a subset of file operations
|
||||
type File interface {
|
||||
io.Closer
|
||||
Readdir(count int) ([]os.FileInfo, error)
|
||||
}
|
||||
|
||||
// An OS abstracts functions in the standard library's os package.
|
||||
type OS interface {
|
||||
Lstat(name string) (os.FileInfo, error)
|
||||
Open(name string) (*os.File, error)
|
||||
Open(name string) (File, error)
|
||||
PathSeparator() rune
|
||||
Stat(name string) (os.FileInfo, error)
|
||||
}
|
||||
|
||||
// StandardOS is a value that implements the OS interface by calling functions
|
||||
// in the standard libray's os package.
|
||||
var StandardOS OS = standardOS{}
|
||||
|
||||
// A standardOS implements OS by calling functions in the standard library's os
|
||||
// package.
|
||||
type standardOS struct{}
|
||||
|
||||
func (standardOS) Lstat(name string) (os.FileInfo, error) { return os.Lstat(name) }
|
||||
func (standardOS) Open(name string) (*os.File, error) { return os.Open(name) }
|
||||
func (standardOS) Open(name string) (File, error) { return os.Open(name) }
|
||||
func (standardOS) PathSeparator() rune { return os.PathSeparator }
|
||||
func (standardOS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) }
|
||||
|
||||
// StandardOS is a value that implements the OS interface by calling functions
|
||||
// in the standard libray's os package.
|
||||
var StandardOS OS = standardOS{}
|
||||
|
||||
// ErrBadPattern indicates a pattern was malformed.
|
||||
var ErrBadPattern = path.ErrBadPattern
|
||||
|
||||
@@ -442,7 +449,7 @@ func doGlob(vos OS, basedir, pattern string, matches []string) (m []string, e er
|
||||
|
||||
files, err := dir.Readdir(-1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return
|
||||
}
|
||||
sort.Slice(files, func(i, j int) bool { return files[i].Name() < files[j].Name() })
|
||||
|
||||
3
vendor/github.com/bmatcuk/doublestar/v2/go.mod
generated
vendored
Normal file
3
vendor/github.com/bmatcuk/doublestar/v2/go.mod
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module github.com/bmatcuk/doublestar/v2
|
||||
|
||||
go 1.12
|
||||
Reference in New Issue
Block a user