From 41793a34685ca910d8896a037d3a9449b44b6fb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 22:51:28 +0000 Subject: [PATCH] Bump github.com/cloudfoundry/bosh-utils from 0.0.450 to 0.0.451 Bumps [github.com/cloudfoundry/bosh-utils](https://github.com/cloudfoundry/bosh-utils) from 0.0.450 to 0.0.451. - [Commits](https://github.com/cloudfoundry/bosh-utils/compare/v0.0.450...v0.0.451) --- updated-dependencies: - dependency-name: github.com/cloudfoundry/bosh-utils dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- .../bosh-utils/crypto/multiple_digest.go | 6 ++--- .../bosh-utils/errors/multi_error.go | 2 +- .../httpclient/default_http_clients.go | 6 ++--- .../bosh-utils/httpclient/http_client.go | 10 ++++---- .../httpclient/mutual_tls_client.go | 2 +- .../httpclient/request_retryable.go | 20 +++++++--------- .../bosh-utils/httpclient/socksify.go | 3 +-- .../cloudfoundry/bosh-utils/logger/async.go | 8 +++---- .../cloudfoundry/bosh-utils/logger/logger.go | 2 +- .../bosh-utils/property/builders.go | 2 +- .../retrystrategy/unlimited_retry_strategy.go | 2 +- .../bosh-utils/system/exec_process.go | 6 ++--- .../bosh-utils/system/exec_process_unix.go | 7 +++--- .../bosh-utils/system/os_file_system.go | 24 +++++++++---------- vendor/modules.txt | 2 +- 17 files changed, 50 insertions(+), 58 deletions(-) diff --git a/go.mod b/go.mod index 39359e96..0572f020 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/Masterminds/semver v1.5.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/cloudfoundry/bosh-cli v6.4.1+incompatible - github.com/cloudfoundry/bosh-utils v0.0.450 + github.com/cloudfoundry/bosh-utils v0.0.451 github.com/cppforlife/go-patch v0.2.0 github.com/google/go-github v17.0.0+incompatible github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index c4897939..2fc0aebf 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/charlievieth/fs v0.0.3 h1:3lZQXTj4PbE81CVPwALSn+JoyCNXkZgORHN6h2XHGlg github.com/charlievieth/fs v0.0.3/go.mod h1:hD4sRzto1Hw8zCua76tNVKZxaeZZr1RiKftjAJQRLLo= github.com/cloudfoundry/bosh-cli v6.4.1+incompatible h1:n5/+NIF9QxvGINOrjh6DmO+GTen78MoCj5+LU9L8bR4= github.com/cloudfoundry/bosh-cli v6.4.1+incompatible/go.mod h1:rzIB+e1sn7wQL/TJ54bl/FemPKRhXby5BIMS3tLuWFM= -github.com/cloudfoundry/bosh-utils v0.0.450 h1:TrbfL+kA2mVHO8y9flscMgtDHmgNnTWDZSmlqI8sw2o= -github.com/cloudfoundry/bosh-utils v0.0.450/go.mod h1:d8HqyXWERdi7SvLemnUBtqaR5dkWcfwFAi8IoX2RA9A= +github.com/cloudfoundry/bosh-utils v0.0.451 h1:uh7l8kkQpbRJaexCtBfMyEpyh4ttuPgwk3aCRMd/8hg= +github.com/cloudfoundry/bosh-utils v0.0.451/go.mod h1:d8HqyXWERdi7SvLemnUBtqaR5dkWcfwFAi8IoX2RA9A= github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e h1:FQdRViaoDphGRfgrotl2QGsX1gbloe57dbGBS5CG6KY= github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e/go.mod h1:PXmcacyJB/pJjSxEl15IU6rEIKXrhZQRzsr0UTkgNNs= github.com/cloudfoundry/socks5-proxy v0.2.115 h1:X/JCvwguXw2bbxrjSfjbSMDVXdT0usoTV73gA1SO1S4= diff --git a/vendor/github.com/cloudfoundry/bosh-utils/crypto/multiple_digest.go b/vendor/github.com/cloudfoundry/bosh-utils/crypto/multiple_digest.go index c4d17190..b2131617 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/crypto/multiple_digest.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/crypto/multiple_digest.go @@ -4,12 +4,12 @@ import ( "errors" "fmt" "io" + "os" "strings" + "unicode" bosherr "github.com/cloudfoundry/bosh-utils/errors" boshsys "github.com/cloudfoundry/bosh-utils/system" - "os" - "unicode" ) type MultipleDigest struct { @@ -59,7 +59,7 @@ func NewMultipleDigest(stream io.ReadSeeker, algos []Algorithm) (MultipleDigest, digests := []Digest{} for _, algo := range algos { - stream.Seek(0, 0) + stream.Seek(0, 0) //nolint:errcheck digest, err := algo.CreateDigest(stream) if err != nil { return MultipleDigest{}, err diff --git a/vendor/github.com/cloudfoundry/bosh-utils/errors/multi_error.go b/vendor/github.com/cloudfoundry/bosh-utils/errors/multi_error.go index 866d9efb..e7dd48d0 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/errors/multi_error.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/errors/multi_error.go @@ -13,7 +13,7 @@ func NewMultiError(errors ...error) error { } func (e MultiError) Error() string { - errors := make([]string, len(e.Errors), len(e.Errors)) + errors := make([]string, len(e.Errors), len(e.Errors)) //nolint:gosimple for i, err := range e.Errors { errors[i] = err.Error() } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/default_http_clients.go b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/default_http_clients.go index 90e9bf31..cc9b8d9a 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/default_http_clients.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/default_http_clients.go @@ -3,7 +3,7 @@ package httpclient import ( "crypto/tls" "crypto/x509" - "io/ioutil" + "io" "log" "net" "net/http" @@ -19,7 +19,7 @@ var ( defaultDialerContextFunc = SOCKS5DialContextFuncFromEnvironment((&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, - }), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(ioutil.Discard, "", log.LstdFlags), 1*time.Minute)) + }), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(io.Discard, "", log.LstdFlags), 1*time.Minute)) ) type Client interface { @@ -58,7 +58,7 @@ func ResetDialerContext() { defaultDialerContextFunc = SOCKS5DialContextFuncFromEnvironment((&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, - }), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(ioutil.Discard, "", log.LstdFlags), 1*time.Minute)) + }), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(io.Discard, "", log.LstdFlags), 1*time.Minute)) } type factory struct{} diff --git a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/http_client.go b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/http_client.go index dc4e514f..210b98b9 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/http_client.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/http_client.go @@ -1,13 +1,11 @@ package httpclient import ( - "net/http" - "strings" - "errors" - "regexp" - + "net/http" "net/url" + "regexp" + "strings" bosherr "github.com/cloudfoundry/bosh-utils/errors" boshlog "github.com/cloudfoundry/bosh-utils/logger" @@ -173,7 +171,7 @@ func scrubEndpointQuery(endpoint string) string { } query := parsedURL.Query() - for key, _ := range query { + for key, _ := range query { //nolint:gosimple query[key] = []string{""} } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/mutual_tls_client.go b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/mutual_tls_client.go index 037257d1..e28839f3 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/mutual_tls_client.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/mutual_tls_client.go @@ -17,7 +17,7 @@ func NewMutualTLSClient(identity tls.Certificate, caCertPool *x509.CertPool, ser ) clientConfig := tlsConfig.Client(tlsconfig.WithAuthority(caCertPool)) - clientConfig.BuildNameToCertificate() + clientConfig.BuildNameToCertificate() //nolint:staticcheck clientConfig.ServerName = serverName return &http.Client{ diff --git a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/request_retryable.go b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/request_retryable.go index 484b7472..2a09f5bf 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/request_retryable.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/request_retryable.go @@ -3,10 +3,8 @@ package httpclient import ( "bytes" "fmt" - "io/ioutil" - "net/http" - "io" + "net/http" bosherr "github.com/cloudfoundry/bosh-utils/errors" boshlog "github.com/cloudfoundry/bosh-utils/logger" @@ -68,7 +66,7 @@ func (r *RequestRetryable) Attempt() (bool, error) { r.request.Body, err = r.request.GetBody() if err != nil { if r.originalBody != nil { - r.originalBody.Close() + r.originalBody.Close() //nolint:errcheck } return false, bosherr.WrapError(err, "Updating request body for retry") @@ -85,9 +83,9 @@ func (r *RequestRetryable) Attempt() (bool, error) { // forcing an EOF. // This should not be necessary when the following CL gets accepted: // https://go-review.googlesource.com/c/go/+/62891 - io.Copy(ioutil.Discard, r.response.Body) + io.Copy(io.Discard, r.response.Body) //nolint:errcheck - r.response.Body.Close() + r.response.Body.Close() //nolint:errcheck } r.attempt++ @@ -97,7 +95,7 @@ func (r *RequestRetryable) Attempt() (bool, error) { attemptable, err := r.isResponseAttemptable(r.response, err) if !attemptable && r.originalBody != nil { - r.originalBody.Close() + r.originalBody.Close() //nolint:errcheck } return attemptable, err @@ -127,7 +125,7 @@ func formatRequest(req *http.Request) string { return fmt.Sprintf("Request{ Method: '%s', URL: '%s' }", req.Method, req.URL) } -func formatResponse(resp *http.Response) string { +func formatResponse(resp *http.Response) string { //nolint:unused if resp == nil { return "Response(nil)" } @@ -153,16 +151,16 @@ func MakeReplayable(r *http.Request) (io.ReadCloser, error) { return nil, bosherr.WrapError(err, "Seeking to beginning of seekable request body") } - return ioutil.NopCloser(seekableBody), nil + return io.NopCloser(seekableBody), nil } } else { - bodyBytes, err := ioutil.ReadAll(r.Body) + bodyBytes, err := io.ReadAll(r.Body) if err != nil { return originalBody, bosherr.WrapError(err, "Buffering request body") } r.GetBody = func() (io.ReadCloser, error) { - return ioutil.NopCloser(bytes.NewReader(bodyBytes)), nil + return io.NopCloser(bytes.NewReader(bodyBytes)), nil } } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/socksify.go b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/socksify.go index abe8c251..5c949470 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/httpclient/socksify.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/httpclient/socksify.go @@ -2,7 +2,6 @@ package httpclient import ( "context" - "io/ioutil" "net" "net/url" "os" @@ -57,7 +56,7 @@ func SOCKS5DialContextFuncFromEnvironment(origDialer *net.Dialer, socks5Proxy Pr ) } - proxySSHKey, err := ioutil.ReadFile(proxySSHKeyPath) + proxySSHKey, err := os.ReadFile(proxySSHKeyPath) if err != nil { return errorDialFunc(err, "Reading private key file for SOCKS5 Proxy") } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go b/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go index ff01ed46..27e8c4ad 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go @@ -43,7 +43,7 @@ func (w *asyncWriter) doFlush() { for i := 0; i < n; i++ { select { case p := <-w.queue: - w.w.Write(p) + w.w.Write(p) //nolint:errcheck default: } } @@ -56,7 +56,7 @@ func (w *asyncWriter) doWork() { w.doFlush() close(c) case p := <-w.queue: - w.w.Write(p) + w.w.Write(p) //nolint:errcheck } } } @@ -67,7 +67,7 @@ type asyncLogger struct { } func (l *asyncLogger) Flush() error { - l.writer.Flush() + l.writer.Flush() //nolint:errcheck return nil } @@ -122,7 +122,7 @@ func (l *asyncLogger) ErrorWithDetails(tag, msg string, args ...interface{}) { func (l *asyncLogger) HandlePanic(tag string) { if l.log.recoverPanic(tag) { - l.FlushTimeout(time.Second * 30) + l.FlushTimeout(time.Second * 30) //nolint:errcheck os.Exit(2) } } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go b/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go index eaaed0c5..3eba37e2 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go @@ -198,7 +198,7 @@ func (l *logger) printf(tag, msg string, args ...interface{}) { l.loggerMu.Lock() timestamp := time.Now().Format(l.timestampFormat) l.logger.SetPrefix("[" + tag + "] " + timestamp + " ") - l.logger.Output(2, s) + l.logger.Output(2, s) //nolint:errcheck l.loggerMu.Unlock() } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/property/builders.go b/vendor/github.com/cloudfoundry/bosh-utils/property/builders.go index 160b21fe..50f5a292 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/property/builders.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/property/builders.go @@ -30,7 +30,7 @@ func BuildMap(rawProperties map[interface{}]interface{}) (Map, error) { // BuildList creates a new property List from an slice of interface{}, erroring if any elements are maps with non-string keys. // Slices in the property List are converted to property Lists. Maps in the property List are converted to property Maps. func BuildList(rawProperties []interface{}) (List, error) { - result := make(List, len(rawProperties), len(rawProperties)) + result := make(List, len(rawProperties), len(rawProperties)) //nolint:gosimple for i, val := range rawProperties { convertedVal, err := Build(val) diff --git a/vendor/github.com/cloudfoundry/bosh-utils/retrystrategy/unlimited_retry_strategy.go b/vendor/github.com/cloudfoundry/bosh-utils/retrystrategy/unlimited_retry_strategy.go index c312aa5a..b3f076ad 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/retrystrategy/unlimited_retry_strategy.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/retrystrategy/unlimited_retry_strategy.go @@ -7,7 +7,7 @@ import ( ) type unlimitedRetryStrategy struct { - maxAttempts int + maxAttempts int //nolint:unused delay time.Duration retryable Retryable logger boshlog.Logger diff --git a/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process.go b/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process.go index b02c904a..dbbc9687 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process.go @@ -21,7 +21,7 @@ type execProcess struct { keepAttached bool quiet bool pid int - pgid int + pgid int //nolint:unused logger boshlog.Logger waitCh chan Result } @@ -56,12 +56,12 @@ func (p *execProcess) wait() Result { // err will be non-nil if command exits with non-0 status err := p.cmd.Wait() - stdout := string(p.stdoutWriter.Bytes()) + stdout := p.stdoutWriter.String() if !p.quiet { p.logger.Debug(execProcessLogTag, "Stdout: %s", stdout) } - stderr := string(p.stderrWriter.Bytes()) + stderr := p.stderrWriter.String() if !p.quiet { p.logger.Debug(execProcessLogTag, "Stderr: %s", stderr) } diff --git a/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process_unix.go b/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process_unix.go index 0bb9eae6..4e46d74e 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process_unix.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/system/exec_process_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package system @@ -108,10 +109,8 @@ func (p *execProcess) signalGroup(sig syscall.Signal) error { func (p *execProcess) groupExists() bool { err := syscall.Kill(-p.pgid, syscall.Signal(0)) - if p.isGroupDoesNotExistError(err) { - return false - } - return true + + return !p.isGroupDoesNotExistError(err) } func (p *execProcess) isGroupDoesNotExistError(err error) bool { diff --git a/vendor/github.com/cloudfoundry/bosh-utils/system/os_file_system.go b/vendor/github.com/cloudfoundry/bosh-utils/system/os_file_system.go index 6c9b08ad..4b127ddd 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/system/os_file_system.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/system/os_file_system.go @@ -2,15 +2,13 @@ package system import ( "bytes" + "errors" "io" - "io/ioutil" "os" "os/exec" "path/filepath" "strings" - "errors" - "github.com/bmatcuk/doublestar" fsWrapper "github.com/charlievieth/fs" bosherr "github.com/cloudfoundry/bosh-utils/errors" @@ -170,7 +168,7 @@ func (fs *osFileSystem) ConvergeFileContents(path string, content []byte, opts . } defer file.Close() - src, err := ioutil.ReadAll(file) + src, err := io.ReadAll(file) if err != nil { return true, bosherr.WrapErrorf(err, "Reading file %s", path) } @@ -216,7 +214,7 @@ func (fs *osFileSystem) ReadFileWithOpts(path string, opts ReadOpts) (content [] defer file.Close() - content, err = ioutil.ReadAll(file) + content, err = io.ReadAll(file) if err != nil { err = bosherr.WrapErrorf(err, "Reading file content %s", path) return @@ -245,7 +243,7 @@ func (fs *osFileSystem) FileExists(path string) bool { func (fs *osFileSystem) Rename(oldPath, newPath string) (err error) { fs.logger.Debug(fs.logTag, "Renaming %s to %s", oldPath, newPath) - fs.RemoveAll(newPath) + fs.RemoveAll(newPath) //nolint:errcheck return fsWrapper.Rename(oldPath, newPath) } @@ -254,16 +252,16 @@ func (fs *osFileSystem) Symlink(oldPath, newPath string) error { source, target, err := fs.symlinkPaths(oldPath, newPath) if err != nil { - bosherr.WrapErrorf(err, "Getting absolute paths for target and path links: %s %s", oldPath, newPath) + bosherr.WrapErrorf(err, "Getting absolute paths for target and path links: %s %s", oldPath, newPath) //nolint:errcheck } if fi, err := fs.Lstat(target); err == nil { if fi.Mode()&os.ModeSymlink != 0 { // Symlink - new, err := fs.Readlink(target) + targetPath, err := fs.Readlink(target) if err != nil { return bosherr.WrapErrorf(err, "Reading link for %s", target) } - if filepath.Clean(source) == filepath.Clean(new) { + if filepath.Clean(source) == filepath.Clean(targetPath) { return nil } } @@ -274,7 +272,7 @@ func (fs *osFileSystem) Symlink(oldPath, newPath string) error { containingDir := filepath.Dir(target) if !fs.FileExists(containingDir) { - fs.MkdirAll(containingDir, os.FileMode(0700)) + fs.MkdirAll(containingDir, os.FileMode(0700)) //nolint:errcheck } return fsWrapper.Symlink(source, target) @@ -376,7 +374,7 @@ func (fs *osFileSystem) TempFile(prefix string) (file File, err error) { if fs.tempRoot == "" && fs.requiresTempRoot { return nil, errors.New("Set a temp directory root with ChangeTempRoot before making temp files") } - return ioutil.TempFile(fs.tempRoot, prefix) + return os.CreateTemp(fs.tempRoot, prefix) } func (fs *osFileSystem) TempDir(prefix string) (path string, err error) { @@ -384,7 +382,7 @@ func (fs *osFileSystem) TempDir(prefix string) (path string, err error) { if fs.tempRoot == "" && fs.requiresTempRoot { return "", errors.New("Set a temp directory root with ChangeTempRoot before making temp directories") } - return ioutil.TempDir(fs.tempRoot, prefix) + return os.MkdirTemp(fs.tempRoot, prefix) } func (fs *osFileSystem) ChangeTempRoot(tempRootPath string) error { @@ -416,7 +414,7 @@ func (fs *osFileSystem) Walk(root string, walkFunc filepath.WalkFunc) error { return filepath.Walk(root, walkFunc) } -func (fs *osFileSystem) runCommand(cmd string) (string, error) { +func (fs *osFileSystem) runCommand(cmd string) (string, error) { //nolint:unused var stdout bytes.Buffer shCmd := exec.Command("sh", "-c", cmd) shCmd.Stdout = &stdout diff --git a/vendor/modules.txt b/vendor/modules.txt index be5897c5..1163a5fa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -29,7 +29,7 @@ github.com/cloudfoundry/bosh-cli/director github.com/cloudfoundry/bosh-cli/director/template github.com/cloudfoundry/bosh-cli/io github.com/cloudfoundry/bosh-cli/uaa -# github.com/cloudfoundry/bosh-utils v0.0.450 +# github.com/cloudfoundry/bosh-utils v0.0.451 ## explicit; go 1.21.0 github.com/cloudfoundry/bosh-utils/crypto github.com/cloudfoundry/bosh-utils/errors