From 99b2a18336b501ab46bcf47772e568965b6d0b2c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Jun 2024 04:31:50 +0000 Subject: [PATCH] fix(deps): update github.com/longhorn/go-common-libs digest to d78642c --- go.mod | 2 +- go.sum | 4 +-- .../longhorn/go-common-libs/io/file.go | 33 +++++++++++++++++++ .../longhorn/go-common-libs/types/crypto.go | 9 +++++ vendor/modules.txt | 2 +- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 498ec835..82742408 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.4 require ( github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 - github.com/longhorn/go-common-libs v0.0.0-20240623073303-1d8b9c5efb84 + github.com/longhorn/go-common-libs v0.0.0-20240627075631-d78642cff5e1 github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index dc71c267..06e13b29 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/longhorn/go-common-libs v0.0.0-20240623073303-1d8b9c5efb84 h1:Xs/R238l7vkix/zu5XfLHmzMWwkN985j9I5msJ1DmgA= -github.com/longhorn/go-common-libs v0.0.0-20240623073303-1d8b9c5efb84/go.mod h1:g9PDfwta/vyRjIadpborYon3OR3c58Dz6zEjHksw6Tk= +github.com/longhorn/go-common-libs v0.0.0-20240627075631-d78642cff5e1 h1:VGSNK9AEL6r9UocxZ0LoFPv1mn/jcstEc3LDS3GedZk= +github.com/longhorn/go-common-libs v0.0.0-20240627075631-d78642cff5e1/go.mod h1:wpLEAlsDCnqBA7QfZg0gxYeR8MmLbWHbdidWYwnRbyM= github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003 h1:Jw9uANsGcHTxp6HcC++/vN17LfeuDmozHI2j6DoZf5E= github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003/go.mod h1:0CLeXlf59Lg6C0kjLSDf47ft73Dh37CwymYRKWwAn04= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= diff --git a/vendor/github.com/longhorn/go-common-libs/io/file.go b/vendor/github.com/longhorn/go-common-libs/io/file.go index 40e60a3d..9bd9d4cc 100644 --- a/vendor/github.com/longhorn/go-common-libs/io/file.go +++ b/vendor/github.com/longhorn/go-common-libs/io/file.go @@ -326,3 +326,36 @@ func IsDirectoryEmpty(directory string) (bool, error) { return false, nil } + +// CheckIsFileSizeSame verifies if all files in the provided paths have the same size. +// It returns an error if any file is a directory, does not exist, or has a different size. +func CheckIsFileSizeSame(paths ...string) error { + referenceInfo, err := os.Stat(paths[0]) + if err != nil { + return err + } + + if referenceInfo.IsDir() { + return errors.Errorf("file %v is a directory", paths[0]) + } + + referenceSize := referenceInfo.Size() + + for _, path := range paths { + fileInfo, err := os.Stat(path) + if err != nil { + return err + } + + if fileInfo.IsDir() { + return errors.Errorf("file %v is a directory", path) + + } + + if fileInfo.Size() != referenceSize { + return errors.Errorf("file %v size %v is not equal to %v", path, fileInfo.Size(), referenceSize) + } + } + + return nil +} diff --git a/vendor/github.com/longhorn/go-common-libs/types/crypto.go b/vendor/github.com/longhorn/go-common-libs/types/crypto.go index 9cde14da..e80df9c1 100644 --- a/vendor/github.com/longhorn/go-common-libs/types/crypto.go +++ b/vendor/github.com/longhorn/go-common-libs/types/crypto.go @@ -4,4 +4,13 @@ import ( "time" ) +const ( + CryptoKeyProvider = "CRYPTO_KEY_PROVIDER" + CryptoKeyValue = "CRYPTO_KEY_VALUE" + CryptoKeyCipher = "CRYPTO_KEY_CIPHER" + CryptoKeyHash = "CRYPTO_KEY_HASH" + CryptoKeySize = "CRYPTO_KEY_SIZE" + CryptoPBKDF = "CRYPTO_PBKDF" +) + const LuksTimeout = time.Minute diff --git a/vendor/modules.txt b/vendor/modules.txt index 7ab38e34..f9598dab 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -17,7 +17,7 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/go-common-libs v0.0.0-20240623073303-1d8b9c5efb84 +# github.com/longhorn/go-common-libs v0.0.0-20240627075631-d78642cff5e1 ## explicit; go 1.22.0 github.com/longhorn/go-common-libs/exec github.com/longhorn/go-common-libs/io