Upgrade doublestar to v2.0.1 (#742)

This commit is contained in:
InfiniteTF
2020-08-17 04:06:40 +02:00
committed by GitHub
parent ecc42e4e24
commit ecf745162f
13 changed files with 41 additions and 19 deletions

2
go.mod
View File

@@ -3,7 +3,7 @@ module github.com/stashapp/stash
require (
github.com/99designs/gqlgen v0.9.0
github.com/antchfx/htmlquery v1.2.3
github.com/bmatcuk/doublestar v1.3.1
github.com/bmatcuk/doublestar/v2 v2.0.1
github.com/chromedp/cdproto v0.0.0-20200608134039-8a80cdaf865c
github.com/chromedp/chromedp v0.5.3
github.com/disintegration/imaging v1.6.0

4
go.sum
View File

@@ -37,8 +37,8 @@ github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
github.com/bmatcuk/doublestar v1.3.1 h1:rT8rxDPsavp9G+4ZULzqhhUSaI/OPsTZNG88Z3i0xvY=
github.com/bmatcuk/doublestar v1.3.1/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
github.com/bmatcuk/doublestar/v2 v2.0.1 h1:EFT91DmIMRcrUEcYUW7AqSAwKvNzP5+CoDmNVBbcQOU=
github.com/bmatcuk/doublestar/v2 v2.0.1/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQmTZRptLie8RgRw=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=

View File

@@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"
"github.com/bmatcuk/doublestar"
"github.com/bmatcuk/doublestar/v2"
"github.com/disintegration/imaging"
"github.com/stashapp/stash/pkg/ffmpeg"
"github.com/stashapp/stash/pkg/logger"

View File

@@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/bmatcuk/doublestar"
"github.com/bmatcuk/doublestar/v2"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/manager/config"
"github.com/stashapp/stash/pkg/models"

View File

@@ -1,3 +0,0 @@
module github.com/bmatcuk/doublestar
go 1.12

View File

@@ -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
View 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.

View File

@@ -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
View File

@@ -0,0 +1,3 @@
module github.com/bmatcuk/doublestar/v2
go 1.12

4
vendor/modules.txt vendored
View File

@@ -23,8 +23,8 @@ github.com/agnivade/levenshtein
github.com/antchfx/htmlquery
# github.com/antchfx/xpath v1.1.6
github.com/antchfx/xpath
# github.com/bmatcuk/doublestar v1.3.1
github.com/bmatcuk/doublestar
# github.com/bmatcuk/doublestar/v2 v2.0.1
github.com/bmatcuk/doublestar/v2
# github.com/chromedp/cdproto v0.0.0-20200608134039-8a80cdaf865c
github.com/chromedp/cdproto
github.com/chromedp/cdproto/accessibility