diff --git a/go.mod b/go.mod index 16e19fb1..bffe360b 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/heroku/heroku-go/v5 v5.2.1 github.com/jftuga/ellipsis v1.0.0 github.com/joho/godotenv v1.3.0 - github.com/karrick/godirwalk v1.16.1 + github.com/karrick/godirwalk v1.17.0 github.com/mattn/lastpass-go v0.0.0-20160926001517-82bef8502f75 github.com/mitchellh/go-homedir v1.1.0 github.com/samber/lo v1.11.0 diff --git a/go.sum b/go.sum index d4bc7073..582ee4f4 100644 --- a/go.sum +++ b/go.sum @@ -585,8 +585,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= -github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/karrick/godirwalk v1.17.0 h1:b4kY7nqDdioR/6qnbHQyDvmA17u5G1cZ6J+CZXwSWoI= +github.com/karrick/godirwalk v1.17.0/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/keeper-security/secrets-manager-go/core v1.6.2 h1:bRZUJI/s5WwVbceSNlKyKqYuBNKkZCyNPH4lU2GYiF0= diff --git a/vendor/github.com/karrick/godirwalk/README.md b/vendor/github.com/karrick/godirwalk/README.md index 0902cce5..ccfb2cba 100644 --- a/vendor/github.com/karrick/godirwalk/README.md +++ b/vendor/github.com/karrick/godirwalk/README.md @@ -5,13 +5,17 @@ system. [![GoDoc](https://godoc.org/github.com/karrick/godirwalk?status.svg)](https://godoc.org/github.com/karrick/godirwalk) [![Build Status](https://dev.azure.com/microsoft0235/microsoft/_apis/build/status/karrick.godirwalk?branchName=master)](https://dev.azure.com/microsoft0235/microsoft/_build/latest?definitionId=1&branchName=master) -In short, why do I use this library? +In short, why did I create this library? 1. It's faster than `filepath.Walk`. 1. It's more correct on Windows than `filepath.Walk`. 1. It's more easy to use than `filepath.Walk`. 1. It's more flexible than `filepath.Walk`. +Depending on your specific circumstances, [you might no longer need a +library for file walking in +Go](https://engineering.kablamo.com.au/posts/2021/quick-comparison-between-go-file-walk-implementations). + ## Usage Example Additional examples are provided in the `examples/` subdirectory. diff --git a/vendor/github.com/karrick/godirwalk/scandir_unix.go b/vendor/github.com/karrick/godirwalk/scandir_unix.go index 33250b61..654039bd 100644 --- a/vendor/github.com/karrick/godirwalk/scandir_unix.go +++ b/vendor/github.com/karrick/godirwalk/scandir_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package godirwalk @@ -22,8 +23,10 @@ type Scanner struct { fd int // file descriptor used to read entries from directory } -// NewScanner returns a new directory Scanner that lazily enumerates the -// contents of a single directory. +// NewScanner returns a new directory Scanner that lazily enumerates +// the contents of a single directory. To prevent resource leaks, +// caller must invoke either the Scanner's Close or Err method after +// it has completed scanning a directory. // // scanner, err := godirwalk.NewScanner(dirname) // if err != nil { @@ -52,10 +55,12 @@ func NewScanner(osDirname string) (*Scanner, error) { return NewScannerWithScratchBuffer(osDirname, nil) } -// NewScannerWithScratchBuffer returns a new directory Scanner that lazily -// enumerates the contents of a single directory. On platforms other than -// Windows it uses the provided scratch buffer to read from the file system. On -// Windows the scratch buffer is ignored. +// NewScannerWithScratchBuffer returns a new directory Scanner that +// lazily enumerates the contents of a single directory. On platforms +// other than Windows it uses the provided scratch buffer to read from +// the file system. On Windows the scratch buffer is ignored. To +// prevent resource leaks, caller must invoke either the Scanner's +// Close or Err method after it has completed scanning a directory. func NewScannerWithScratchBuffer(osDirname string, scratchBuffer []byte) (*Scanner, error) { dh, err := os.Open(osDirname) if err != nil { @@ -73,6 +78,13 @@ func NewScannerWithScratchBuffer(osDirname string, scratchBuffer []byte) (*Scann return scanner, nil } +// Close releases resources associated with scanning a directory. Call +// either this or the Err method when the directory no longer needs to +// be scanned. +func (s *Scanner) Close() error { + return s.Err() +} + // Dirent returns the current directory entry while scanning a directory. func (s *Scanner) Dirent() (*Dirent, error) { if s.de == nil { @@ -90,8 +102,10 @@ func (s *Scanner) done(err error) { return } - if cerr := s.dh.Close(); err == nil { - s.err = cerr + s.err = err + + if err = s.dh.Close(); s.err == nil { + s.err = err } s.osDirname, s.childName = "", "" @@ -101,9 +115,10 @@ func (s *Scanner) done(err error) { s.fd = 0 } -// Err returns any error associated with scanning a directory. It is normal to -// call Err after Scan returns false, even though they both ensure Scanner -// resources are released. Do not call until done scanning a directory. +// Err returns any error associated with scanning a directory. It is +// normal to call Err after Scan returns false, even though they both +// ensure Scanner resources are released. Call either this or the +// Close method when the directory no longer needs to be scanned. func (s *Scanner) Err() error { s.done(nil) return s.err @@ -135,7 +150,7 @@ func (s *Scanner) Scan() bool { if err == syscall.EINTR /* || err == unix.EINTR */ { continue } - s.done(err) + s.done(err) // any other error forces a stop return false } if n <= 0 { // end of directory: normal exit diff --git a/vendor/github.com/karrick/godirwalk/scandir_windows.go b/vendor/github.com/karrick/godirwalk/scandir_windows.go index a2110618..338e3236 100644 --- a/vendor/github.com/karrick/godirwalk/scandir_windows.go +++ b/vendor/github.com/karrick/godirwalk/scandir_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package godirwalk @@ -17,8 +18,10 @@ type Scanner struct { childMode os.FileMode } -// NewScanner returns a new directory Scanner that lazily enumerates the -// contents of a single directory. +// NewScanner returns a new directory Scanner that lazily enumerates +// the contents of a single directory. To prevent resource leaks, +// caller must invoke either the Scanner's Close or Err method after +// it has completed scanning a directory. // // scanner, err := godirwalk.NewScanner(dirname) // if err != nil { @@ -55,14 +58,24 @@ func NewScanner(osDirname string) (*Scanner, error) { return scanner, nil } -// NewScannerWithScratchBuffer returns a new directory Scanner that lazily -// enumerates the contents of a single directory. On platforms other than -// Windows it uses the provided scratch buffer to read from the file system. On -// Windows the scratch buffer parameter is ignored. +// NewScannerWithScratchBuffer returns a new directory Scanner that +// lazily enumerates the contents of a single directory. On platforms +// other than Windows it uses the provided scratch buffer to read from +// the file system. On Windows the scratch buffer parameter is +// ignored. To prevent resource leaks, caller must invoke either the +// Scanner's Close or Err method after it has completed scanning a +// directory. func NewScannerWithScratchBuffer(osDirname string, scratchBuffer []byte) (*Scanner, error) { return NewScanner(osDirname) } +// Close releases resources associated with scanning a directory. Call +// either this or the Err method when the directory no longer needs to +// be scanned. +func (s *Scanner) Close() error { + return s.Err() +} + // Dirent returns the current directory entry while scanning a directory. func (s *Scanner) Dirent() (*Dirent, error) { if s.de == nil { @@ -83,17 +96,20 @@ func (s *Scanner) done(err error) { return } - if cerr := s.dh.Close(); err == nil { - s.err = cerr + s.err = err + + if err = s.dh.Close(); s.err == nil { + s.err = err } s.childName, s.osDirname = "", "" s.de, s.dh = nil, nil } -// Err returns any error associated with scanning a directory. It is normal to -// call Err after Scan returns false, even though they both ensure Scanner -// resources are released. Do not call until done scanning a directory. +// Err returns any error associated with scanning a directory. It is +// normal to call Err after Scan returns false, even though they both +// ensure Scanner resources are released. Call either this or the +// Close method when the directory no longer needs to be scanned. func (s *Scanner) Err() error { s.done(nil) return s.err diff --git a/vendor/modules.txt b/vendor/modules.txt index e3a268a8..569a6844 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -525,7 +525,7 @@ github.com/jmespath/go-jmespath # github.com/joho/godotenv v1.3.0 ## explicit github.com/joho/godotenv -# github.com/karrick/godirwalk v1.16.1 +# github.com/karrick/godirwalk v1.17.0 ## explicit; go 1.13 github.com/karrick/godirwalk # github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51