From ecf745162f31e557964a14ff2a9625a2c961d408 Mon Sep 17 00:00:00 2001 From: InfiniteTF Date: Mon, 17 Aug 2020 04:06:40 +0200 Subject: [PATCH] Upgrade doublestar to v2.0.1 (#742) --- go.mod | 2 +- go.sum | 4 ++-- pkg/manager/generator_sprite.go | 2 +- pkg/manager/manager_tasks.go | 2 +- vendor/github.com/bmatcuk/doublestar/go.mod | 3 --- .../bmatcuk/doublestar/{ => v2}/.gitignore | 0 .../bmatcuk/doublestar/{ => v2}/.travis.yml | 0 .../bmatcuk/doublestar/{ => v2}/LICENSE | 0 .../bmatcuk/doublestar/{ => v2}/README.md | 6 ++++-- .../bmatcuk/doublestar/v2/UPGRADING.md | 13 ++++++++++++ .../bmatcuk/doublestar/{ => v2}/doublestar.go | 21 ++++++++++++------- .../github.com/bmatcuk/doublestar/v2/go.mod | 3 +++ vendor/modules.txt | 4 ++-- 13 files changed, 41 insertions(+), 19 deletions(-) delete mode 100644 vendor/github.com/bmatcuk/doublestar/go.mod rename vendor/github.com/bmatcuk/doublestar/{ => v2}/.gitignore (100%) rename vendor/github.com/bmatcuk/doublestar/{ => v2}/.travis.yml (100%) rename vendor/github.com/bmatcuk/doublestar/{ => v2}/LICENSE (100%) rename vendor/github.com/bmatcuk/doublestar/{ => v2}/README.md (97%) create mode 100644 vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md rename vendor/github.com/bmatcuk/doublestar/{ => v2}/doublestar.go (98%) create mode 100644 vendor/github.com/bmatcuk/doublestar/v2/go.mod diff --git a/go.mod b/go.mod index 0c7b205ee..a822751e1 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 838ddc334..d1da3efc4 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/manager/generator_sprite.go b/pkg/manager/generator_sprite.go index 96578c08b..5efcf2127 100644 --- a/pkg/manager/generator_sprite.go +++ b/pkg/manager/generator_sprite.go @@ -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" diff --git a/pkg/manager/manager_tasks.go b/pkg/manager/manager_tasks.go index e297e3eec..a92c9cb98 100644 --- a/pkg/manager/manager_tasks.go +++ b/pkg/manager/manager_tasks.go @@ -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" diff --git a/vendor/github.com/bmatcuk/doublestar/go.mod b/vendor/github.com/bmatcuk/doublestar/go.mod deleted file mode 100644 index ce1688f73..000000000 --- a/vendor/github.com/bmatcuk/doublestar/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/bmatcuk/doublestar - -go 1.12 diff --git a/vendor/github.com/bmatcuk/doublestar/.gitignore b/vendor/github.com/bmatcuk/doublestar/v2/.gitignore similarity index 100% rename from vendor/github.com/bmatcuk/doublestar/.gitignore rename to vendor/github.com/bmatcuk/doublestar/v2/.gitignore diff --git a/vendor/github.com/bmatcuk/doublestar/.travis.yml b/vendor/github.com/bmatcuk/doublestar/v2/.travis.yml similarity index 100% rename from vendor/github.com/bmatcuk/doublestar/.travis.yml rename to vendor/github.com/bmatcuk/doublestar/v2/.travis.yml diff --git a/vendor/github.com/bmatcuk/doublestar/LICENSE b/vendor/github.com/bmatcuk/doublestar/v2/LICENSE similarity index 100% rename from vendor/github.com/bmatcuk/doublestar/LICENSE rename to vendor/github.com/bmatcuk/doublestar/v2/LICENSE diff --git a/vendor/github.com/bmatcuk/doublestar/README.md b/vendor/github.com/bmatcuk/doublestar/v2/README.md similarity index 97% rename from vendor/github.com/bmatcuk/doublestar/README.md rename to vendor/github.com/bmatcuk/doublestar/v2/README.md index 074b77d85..44631dcfe 100644 --- a/vendor/github.com/bmatcuk/doublestar/README.md +++ b/vendor/github.com/bmatcuk/doublestar/v2/README.md @@ -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 diff --git a/vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md b/vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md new file mode 100644 index 000000000..8193544fe --- /dev/null +++ b/vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md @@ -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. diff --git a/vendor/github.com/bmatcuk/doublestar/doublestar.go b/vendor/github.com/bmatcuk/doublestar/v2/doublestar.go similarity index 98% rename from vendor/github.com/bmatcuk/doublestar/doublestar.go rename to vendor/github.com/bmatcuk/doublestar/v2/doublestar.go index 2c6fab48c..10ce4d404 100644 --- a/vendor/github.com/bmatcuk/doublestar/doublestar.go +++ b/vendor/github.com/bmatcuk/doublestar/v2/doublestar.go @@ -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() }) diff --git a/vendor/github.com/bmatcuk/doublestar/v2/go.mod b/vendor/github.com/bmatcuk/doublestar/v2/go.mod new file mode 100644 index 000000000..f0fa6bc59 --- /dev/null +++ b/vendor/github.com/bmatcuk/doublestar/v2/go.mod @@ -0,0 +1,3 @@ +module github.com/bmatcuk/doublestar/v2 + +go 1.12 diff --git a/vendor/modules.txt b/vendor/modules.txt index 968c9c462..f452415b5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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