From c67bb32f0c76ee36607078a3a7636dac81cf0fea Mon Sep 17 00:00:00 2001 From: Derek Su Date: Thu, 9 Oct 2025 15:01:07 +0800 Subject: [PATCH] chore(vendor): replace github.com/pkg/errors with github.com/cockroachdb/errors github.com/pkg/errors is archived and not maintained. Longhorn 11413 Signed-off-by: Derek Su --- app/cmd/process.go | 2 +- app/cmd/start.go | 6 +- app/cmd/version.go | 2 +- go.mod | 12 +- go.sum | 19 +-- pkg/client/disk.go | 2 +- pkg/client/instance.go | 2 +- pkg/client/process_manager.go | 2 +- pkg/client/proxy.go | 2 +- pkg/client/proxy_backing_image.go | 2 +- pkg/client/proxy_backup.go | 2 +- pkg/client/proxy_metrics.go | 2 +- pkg/client/proxy_replica.go | 2 +- pkg/client/proxy_snapshot.go | 5 +- pkg/client/proxy_volume.go | 2 +- pkg/disk/disk.go | 13 +- pkg/instance/instance.go | 2 +- pkg/instance/log.go | 2 +- pkg/process/process_manager.go | 2 +- pkg/proxy/backing_image.go | 2 +- pkg/proxy/backup.go | 2 +- pkg/proxy/proxy.go | 2 +- pkg/proxy/replica.go | 2 +- pkg/proxy/snapshot.go | 2 +- pkg/util/util.go | 3 +- vendor/github.com/gofrs/flock/.golangci.yml | 150 +++++++++--------- vendor/github.com/gofrs/flock/LICENSE | 2 +- vendor/github.com/gofrs/flock/flock.go | 20 ++- vendor/github.com/gofrs/flock/flock_others.go | 5 + vendor/github.com/gofrs/flock/flock_unix.go | 3 +- .../gofrs/flock/flock_unix_fcntl.go | 2 +- .../github.com/gofrs/flock/flock_windows.go | 4 +- .../go-iscsi-helper/iscsi/initiator.go | 2 +- .../longhorn/go-iscsi-helper/iscsi/target.go | 2 +- .../go-iscsi-helper/iscsidev/iscsi.go | 2 +- .../go-iscsi-helper/longhorndev/dev.go | 2 +- .../longhorn/go-iscsi-helper/util/util.go | 2 +- .../controller/client/controller_client.go | 2 +- .../longhorn-engine/pkg/replica/backup.go | 3 +- .../pkg/replica/client/client.go | 5 +- .../longhorn-engine/pkg/replica/diff_disk.go | 2 +- .../longhorn-engine/pkg/replica/hash.go | 4 +- .../longhorn-engine/pkg/replica/replica.go | 6 +- .../longhorn-engine/pkg/replica/restore.go | 2 +- .../pkg/replica/revision_counter.go | 2 +- .../longhorn-engine/pkg/sync/backup.go | 2 +- .../longhorn/longhorn-engine/pkg/sync/sync.go | 8 +- .../longhorn-engine/pkg/util/fsfreeze.go | 5 +- .../longhorn/sparse-tools/sparse/client.go | 11 +- .../longhorn/sparse-tools/sparse/file.go | 9 +- .../longhorn/sparse-tools/sparse/local.go | 12 +- .../longhorn/sparse-tools/sparse/sfold.go | 11 +- .../longhorn/sparse-tools/sparse/sprune.go | 11 +- .../longhorn/sparse-tools/util/hash.go | 8 +- vendor/modules.txt | 14 +- 55 files changed, 236 insertions(+), 173 deletions(-) diff --git a/app/cmd/process.go b/app/cmd/process.go index 70f5bb144..52811a328 100644 --- a/app/cmd/process.go +++ b/app/cmd/process.go @@ -4,7 +4,7 @@ import ( "context" "path/filepath" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" diff --git a/app/cmd/start.go b/app/cmd/start.go index bdf49ff42..aa0282185 100644 --- a/app/cmd/start.go +++ b/app/cmd/start.go @@ -14,14 +14,16 @@ import ( "syscall" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" "golang.org/x/sync/errgroup" "google.golang.org/grpc" - healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/reflection" + + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "k8s.io/mount-utils" engineutil "github.com/longhorn/longhorn-engine/pkg/util" diff --git a/app/cmd/version.go b/app/cmd/version.go index d9c4a2ef5..13503f43a 100644 --- a/app/cmd/version.go +++ b/app/cmd/version.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" diff --git a/go.mod b/go.mod index 0a2b65de3..281369313 100644 --- a/go.mod +++ b/go.mod @@ -5,14 +5,14 @@ go 1.24.0 toolchain go1.25.3 require ( + github.com/cockroachdb/errors v1.12.0 github.com/google/uuid v1.6.0 github.com/longhorn/backupstore v0.0.0-20251009075049-1b6c3422a333 github.com/longhorn/go-common-libs v0.0.0-20251019060945-fb1eaf5233d1 github.com/longhorn/go-spdk-helper v0.0.4 - github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20250911042227-b892286beabd + github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20251020071219-064944a97ca5 github.com/longhorn/longhorn-spdk-engine v0.0.0-20251023092409-3c3113c50437 github.com/longhorn/types v0.0.0-20251019113838-3455d9c2f5ca - github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 github.com/urfave/cli v1.22.17 golang.org/x/net v0.46.0 @@ -34,7 +34,6 @@ require ( github.com/bits-and-blooms/bitset v1.16.0 // indirect github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cockroachdb/errors v1.12.0 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect @@ -50,7 +49,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/gofrs/flock v0.12.1 // indirect + github.com/gofrs/flock v0.13.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect @@ -60,8 +59,8 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/longhorn/go-iscsi-helper v0.0.0-20250810143507-5c5f9a0060b4 // indirect - github.com/longhorn/sparse-tools v0.0.0-20250826041019-4aae87cb253a // indirect + github.com/longhorn/go-iscsi-helper v0.0.0-20251009073425-68f54afcf47e // indirect + github.com/longhorn/sparse-tools v0.0.0-20251020055717-ae3aca526fd7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect @@ -70,6 +69,7 @@ require ( github.com/mschoch/smat v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect diff --git a/go.sum b/go.sum index e7728e849..f55c95b02 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= -github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= +github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= +github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= @@ -119,16 +119,16 @@ github.com/longhorn/backupstore v0.0.0-20251009075049-1b6c3422a333 h1:mJiphHiQRC github.com/longhorn/backupstore v0.0.0-20251009075049-1b6c3422a333/go.mod h1:aA1kAXXtLyqIik2X9NcRDhVK646/P/RlnhmgBU/sq5A= github.com/longhorn/go-common-libs v0.0.0-20251019060945-fb1eaf5233d1 h1:p1fzxKB/zhVIEM8ihEN4qb8xfqEbAV4aNseizLEImV4= github.com/longhorn/go-common-libs v0.0.0-20251019060945-fb1eaf5233d1/go.mod h1:bh55XdQ56R2SYaH1CJsFLMb99vocUdgMHZ3+n3m2jHk= -github.com/longhorn/go-iscsi-helper v0.0.0-20250810143507-5c5f9a0060b4 h1:i6Wac1SO2YwXkqZetnc1KZc+2PnFZ9xSUs99nFAhHiU= -github.com/longhorn/go-iscsi-helper v0.0.0-20250810143507-5c5f9a0060b4/go.mod h1:EIkghFAyqv+8ktznS4a+leJ6KKQLPt9zrcdS2Zsfk+M= +github.com/longhorn/go-iscsi-helper v0.0.0-20251009073425-68f54afcf47e h1:VRsmtZ6wQVBpq8RjXaGxWU+6MOfB208YNWr2dauNP+A= +github.com/longhorn/go-iscsi-helper v0.0.0-20251009073425-68f54afcf47e/go.mod h1:L+CaJlkunZd/KEdgvNQme6Re/57GX7nLL/Hs9BPJ6Nk= github.com/longhorn/go-spdk-helper v0.0.4 h1:Or7+7LSHpT8wBEtvv22Q9E/Tl9ks46DFC3N8r+x1dQk= github.com/longhorn/go-spdk-helper v0.0.4/go.mod h1:jXiQGipYcnbRZZ7mu5gCM4bbAtNeL9g+4UkDsjaTEzY= -github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20250911042227-b892286beabd h1:2GDnGZ+CzRJR9iAdXvtEYBS60f8mZvmPOkCSr1Fk/DA= -github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20250911042227-b892286beabd/go.mod h1:MPuXGH5nz8kOTO9w1Oydh7yJZvPJRQ1G13jRPf4T0o0= +github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20251020071219-064944a97ca5 h1:jt1SuyRSXrVade97qh5RSaerM/XVKJ17qGyOSOzuDeA= +github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20251020071219-064944a97ca5/go.mod h1:0l6XL8nqyzbHuGE7sU9ejKJuyik2+X/X7Q7fodhHC7k= github.com/longhorn/longhorn-spdk-engine v0.0.0-20251023092409-3c3113c50437 h1:C8kq+8pfoCCFaSorUg1l8XphTmvaqmp/JpVYJhV4h10= github.com/longhorn/longhorn-spdk-engine v0.0.0-20251023092409-3c3113c50437/go.mod h1:4EzBtM9uzriBBx7ReyU1ckmMMFYaeZffXauszt08nq8= -github.com/longhorn/sparse-tools v0.0.0-20250826041019-4aae87cb253a h1:uiECueW4EyOjfaw0GgKlbJjAjDBgQlsDiQjXDU262VY= -github.com/longhorn/sparse-tools v0.0.0-20250826041019-4aae87cb253a/go.mod h1:dfbJqfI8+T9ZCp5zhTYcBi/64hPBNt5/vFF3gTlfMmc= +github.com/longhorn/sparse-tools v0.0.0-20251020055717-ae3aca526fd7 h1:t+ufkrgYbdzSjfGmsorKS7wjHR8nkOtzlOQOVKTrYDk= +github.com/longhorn/sparse-tools v0.0.0-20251020055717-ae3aca526fd7/go.mod h1:WfRkt5pFnDaULAjFtoGlWhwQwyIx/vgMnH+jXQNlnQ8= github.com/longhorn/types v0.0.0-20251019113838-3455d9c2f5ca h1:PloBEw1MQHpbDzlg1IWMbGJOz0L2F7WzRXrAXwFEV6g= github.com/longhorn/types v0.0.0-20251019113838-3455d9c2f5ca/go.mod h1:WHi/J4TaEYhP5+34CAa+WkmICsnQ/6XO+lkU1dZqWZQ= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -208,8 +208,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ= github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= diff --git a/pkg/client/disk.go b/pkg/client/disk.go index 85c527d27..478715197 100644 --- a/pkg/client/disk.go +++ b/pkg/client/disk.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/client/instance.go b/pkg/client/instance.go index c353834b4..a0caa2a3c 100644 --- a/pkg/client/instance.go +++ b/pkg/client/instance.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/client/process_manager.go b/pkg/client/process_manager.go index 49bac302a..13eee4b26 100644 --- a/pkg/client/process_manager.go +++ b/pkg/client/process_manager.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/client/proxy.go b/pkg/client/proxy.go index a8642236d..18972ccfd 100644 --- a/pkg/client/proxy.go +++ b/pkg/client/proxy.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/pkg/client/proxy_backing_image.go b/pkg/client/proxy_backing_image.go index 5182f331f..747f0bf5b 100644 --- a/pkg/client/proxy_backing_image.go +++ b/pkg/client/proxy_backing_image.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "google.golang.org/protobuf/types/known/emptypb" "github.com/longhorn/longhorn-instance-manager/pkg/api" diff --git a/pkg/client/proxy_backup.go b/pkg/client/proxy_backup.go index acc2bfcef..40791a0ba 100644 --- a/pkg/client/proxy_backup.go +++ b/pkg/client/proxy_backup.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "google.golang.org/protobuf/types/known/emptypb" rpc "github.com/longhorn/types/pkg/generated/imrpc" diff --git a/pkg/client/proxy_metrics.go b/pkg/client/proxy_metrics.go index 402b6fab9..d952f5802 100644 --- a/pkg/client/proxy_metrics.go +++ b/pkg/client/proxy_metrics.go @@ -3,7 +3,7 @@ package client import ( "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" rpc "github.com/longhorn/types/pkg/generated/imrpc" ) diff --git a/pkg/client/proxy_replica.go b/pkg/client/proxy_replica.go index 61f4878bf..83d2a2890 100644 --- a/pkg/client/proxy_replica.go +++ b/pkg/client/proxy_replica.go @@ -3,7 +3,7 @@ package client import ( "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" etypes "github.com/longhorn/longhorn-engine/pkg/types" rpc "github.com/longhorn/types/pkg/generated/imrpc" diff --git a/pkg/client/proxy_snapshot.go b/pkg/client/proxy_snapshot.go index e86b29b7c..0b6b550d3 100644 --- a/pkg/client/proxy_snapshot.go +++ b/pkg/client/proxy_snapshot.go @@ -3,11 +3,12 @@ package client import ( "fmt" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" + + "github.com/longhorn/types/pkg/generated/enginerpc" etypes "github.com/longhorn/longhorn-engine/pkg/types" eutil "github.com/longhorn/longhorn-engine/pkg/util" - "github.com/longhorn/types/pkg/generated/enginerpc" rpc "github.com/longhorn/types/pkg/generated/imrpc" ) diff --git a/pkg/client/proxy_volume.go b/pkg/client/proxy_volume.go index a01352e62..c0504d323 100644 --- a/pkg/client/proxy_volume.go +++ b/pkg/client/proxy_volume.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" etypes "github.com/longhorn/longhorn-engine/pkg/types" "github.com/longhorn/types/pkg/generated/enginerpc" diff --git a/pkg/disk/disk.go b/pkg/disk/disk.go index eaf30c723..07c34528e 100644 --- a/pkg/disk/disk.go +++ b/pkg/disk/disk.go @@ -6,16 +6,19 @@ import ( "sync" "time" + "github.com/cockroachdb/errors" + "github.com/sirupsen/logrus" + "google.golang.org/protobuf/types/known/emptypb" + + grpccodes "google.golang.org/grpc/codes" + grpcstatus "google.golang.org/grpc/status" + "github.com/longhorn/longhorn-spdk-engine/pkg/api" + spdkclient "github.com/longhorn/longhorn-spdk-engine/pkg/client" enginerpc "github.com/longhorn/types/pkg/generated/enginerpc" rpc "github.com/longhorn/types/pkg/generated/imrpc" spdkrpc "github.com/longhorn/types/pkg/generated/spdkrpc" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - grpccodes "google.golang.org/grpc/codes" - grpcstatus "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" "github.com/longhorn/longhorn-instance-manager/pkg/meta" "github.com/longhorn/longhorn-instance-manager/pkg/types" diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 21a9ce1ec..20f932d4b 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -6,7 +6,7 @@ import ( "io" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/instance/log.go b/pkg/instance/log.go index 575ecdb47..56725cffa 100644 --- a/pkg/instance/log.go +++ b/pkg/instance/log.go @@ -3,7 +3,7 @@ package instance import ( "strings" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/process/process_manager.go b/pkg/process/process_manager.go index a8658d533..14792aa01 100644 --- a/pkg/process/process_manager.go +++ b/pkg/process/process_manager.go @@ -10,7 +10,7 @@ import ( "syscall" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/grpc/codes" diff --git a/pkg/proxy/backing_image.go b/pkg/proxy/backing_image.go index 07e15f836..66cd772b9 100644 --- a/pkg/proxy/backing_image.go +++ b/pkg/proxy/backing_image.go @@ -7,7 +7,7 @@ import ( grpccodes "google.golang.org/grpc/codes" grpcstatus "google.golang.org/grpc/status" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "golang.org/x/sync/errgroup" diff --git a/pkg/proxy/backup.go b/pkg/proxy/backup.go index 417da1124..d83fe85b8 100644 --- a/pkg/proxy/backup.go +++ b/pkg/proxy/backup.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index 919576d95..5a8a56d0d 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -4,7 +4,7 @@ import ( "net" "strconv" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/proxy/replica.go b/pkg/proxy/replica.go index 3a8d64b2d..9e8648193 100644 --- a/pkg/proxy/replica.go +++ b/pkg/proxy/replica.go @@ -3,7 +3,7 @@ package proxy import ( "strings" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/proxy/snapshot.go b/pkg/proxy/snapshot.go index 63489014e..e969419e0 100644 --- a/pkg/proxy/snapshot.go +++ b/pkg/proxy/snapshot.go @@ -3,7 +3,7 @@ package proxy import ( "strconv" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/protobuf/types/known/emptypb" diff --git a/pkg/util/util.go b/pkg/util/util.go index 7acaee2a8..f79c3aa15 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -12,9 +12,10 @@ import ( "strings" "time" + "github.com/cockroachdb/errors" "github.com/google/uuid" - "github.com/pkg/errors" "github.com/sirupsen/logrus" + "k8s.io/mount-utils" spdkhelpertypes "github.com/longhorn/go-spdk-helper/pkg/types" diff --git a/vendor/github.com/gofrs/flock/.golangci.yml b/vendor/github.com/gofrs/flock/.golangci.yml index 3ad88a38f..bc837b266 100644 --- a/vendor/github.com/gofrs/flock/.golangci.yml +++ b/vendor/github.com/gofrs/flock/.golangci.yml @@ -1,5 +1,12 @@ -run: - timeout: 10m +version: "2" + +formatters: + enable: + - gofumpt + - goimports + settings: + gofumpt: + extra-rules: true linters: enable: @@ -18,9 +25,7 @@ linters: - gocritic - godot - godox - - gofumpt - goheader - - goimports - gomoddirectives - goprintffuncname - gosec @@ -31,84 +36,81 @@ linters: - misspell - nolintlint - revive - - stylecheck - - tenv + - staticcheck - testifylint - thelper - unconvert - unparam - usestdlibvars - whitespace - -linters-settings: - misspell: - locale: US - godox: - keywords: - - FIXME - goheader: - template: |- - Copyright 2015 Tim Heckman. All rights reserved. - Copyright 2018-{{ YEAR }} The Gofrs. All rights reserved. - Use of this source code is governed by the BSD 3-Clause - license that can be found in the LICENSE file. - gofumpt: - extra-rules: true - gocritic: - enabled-tags: - - diagnostic - - style - - performance - disabled-checks: - - paramTypeCombine # already handle by gofumpt.extra-rules - - whyNoLint # already handle by nonolint - - unnamedResult - - hugeParam - - sloppyReassign - - rangeValCopy - - octalLiteral - - ptrToRefParam - - appendAssign - - ruleguard - - httpNoBody - - exposedSyncMutex - - revive: - rules: - - name: struct-tag - - name: blank-imports - - name: context-as-argument - - name: context-keys-type - - name: dot-imports - - name: error-return - - name: error-strings - - name: error-naming - - name: exported - - name: if-return - - name: increment-decrement - - name: var-naming - - name: var-declaration - - name: package-comments - - name: range - - name: receiver-naming - - name: time-naming - - name: unexported-return - - name: indent-error-flow - - name: errorf - - name: empty-block - - name: superfluous-else - - name: unused-parameter - - name: unreachable-code - - name: redefines-builtin-id + - wsl_v5 + settings: + gocritic: + disabled-checks: + - paramTypeCombine # already handle by gofumpt.extra-rules + - whyNoLint # already handle by nonolint + - unnamedResult + - hugeParam + - sloppyReassign + - rangeValCopy + - octalLiteral + - ptrToRefParam + - appendAssign + - ruleguard + - httpNoBody + - exposedSyncMutex + enabled-tags: + - diagnostic + - style + - performance + godox: + keywords: + - FIXME + goheader: + template: |- + Copyright 2015 Tim Heckman. All rights reserved. + Copyright 2018-{{ YEAR }} The Gofrs. All rights reserved. + Use of this source code is governed by the BSD 3-Clause + license that can be found in the LICENSE file. + gosec: + excludes: + - G115 + misspell: + locale: US + revive: + rules: + - name: struct-tag + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + - name: error-strings + - name: error-naming + - name: exported + - name: if-return + - name: increment-decrement + - name: var-naming + - name: var-declaration + - name: package-comments + - name: range + - name: receiver-naming + - name: time-naming + - name: unexported-return + - name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + - name: unused-parameter + - name: unreachable-code + - name: redefines-builtin-id + exclusions: + presets: + - comments + - common-false-positives + - std-error-handling issues: - exclude-use-default: true max-issues-per-linter: 0 max-same-issues: 0 -output: - show-stats: true - sort-results: true - sort-order: - - linter - - file diff --git a/vendor/github.com/gofrs/flock/LICENSE b/vendor/github.com/gofrs/flock/LICENSE index 7de525bf0..c785e5e4b 100644 --- a/vendor/github.com/gofrs/flock/LICENSE +++ b/vendor/github.com/gofrs/flock/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2024, The Gofrs +Copyright (c) 2018-2025, The Gofrs Copyright (c) 2015-2020, Tim Heckman All rights reserved. diff --git a/vendor/github.com/gofrs/flock/flock.go b/vendor/github.com/gofrs/flock/flock.go index ff942b228..4cb0746a7 100644 --- a/vendor/github.com/gofrs/flock/flock.go +++ b/vendor/github.com/gofrs/flock/flock.go @@ -1,5 +1,5 @@ // Copyright 2015 Tim Heckman. All rights reserved. -// Copyright 2018-2024 The Gofrs. All rights reserved. +// Copyright 2018-2025 The Gofrs. All rights reserved. // Use of this source code is governed by the BSD 3-Clause // license that can be found in the LICENSE file. @@ -62,6 +62,7 @@ type Flock struct { func New(path string, opts ...Option) *Flock { // create it if it doesn't exist, and open the file read-only. flags := os.O_CREATE + switch runtime.GOOS { case "aix", "solaris", "illumos": // AIX cannot preform write-lock (i.e. exclusive) on a read-only file. @@ -124,6 +125,22 @@ func (f *Flock) RLocked() bool { return f.r } +// Stat returns the FileInfo structure describing the lock file. +// If the lock file does not exist or cannot be accessed, an error is returned. +// +// This can be used to check the modification time of the lock file, +// which is useful for detecting stale locks. +func (f *Flock) Stat() (fs.FileInfo, error) { + f.m.RLock() + defer f.m.RUnlock() + + if f.fh != nil { + return f.fh.Stat() + } + + return os.Stat(f.path) +} + func (f *Flock) String() string { return f.path } @@ -158,7 +175,6 @@ func tryCtx(ctx context.Context, fn func() (bool, error), retryDelay time.Durati case <-ctx.Done(): return false, ctx.Err() case <-time.After(retryDelay): - // try again } } } diff --git a/vendor/github.com/gofrs/flock/flock_others.go b/vendor/github.com/gofrs/flock/flock_others.go index 18b14f1bd..92d0f7e95 100644 --- a/vendor/github.com/gofrs/flock/flock_others.go +++ b/vendor/github.com/gofrs/flock/flock_others.go @@ -1,3 +1,8 @@ +// Copyright 2015 Tim Heckman. All rights reserved. +// Copyright 2018-2025 The Gofrs. All rights reserved. +// Use of this source code is governed by the BSD 3-Clause +// license that can be found in the LICENSE file. + //go:build (!unix && !windows) || plan9 package flock diff --git a/vendor/github.com/gofrs/flock/flock_unix.go b/vendor/github.com/gofrs/flock/flock_unix.go index cf8919c7a..77de7a883 100644 --- a/vendor/github.com/gofrs/flock/flock_unix.go +++ b/vendor/github.com/gofrs/flock/flock_unix.go @@ -1,5 +1,5 @@ // Copyright 2015 Tim Heckman. All rights reserved. -// Copyright 2018-2024 The Gofrs. All rights reserved. +// Copyright 2018-2025 The Gofrs. All rights reserved. // Use of this source code is governed by the BSD 3-Clause // license that can be found in the LICENSE file. @@ -155,6 +155,7 @@ func (f *Flock) try(locked *bool, flag int) (bool, error) { } var retried bool + retry: err := unix.Flock(int(f.fh.Fd()), flag|unix.LOCK_NB) diff --git a/vendor/github.com/gofrs/flock/flock_unix_fcntl.go b/vendor/github.com/gofrs/flock/flock_unix_fcntl.go index ea007b47d..05c2f88c6 100644 --- a/vendor/github.com/gofrs/flock/flock_unix_fcntl.go +++ b/vendor/github.com/gofrs/flock/flock_unix_fcntl.go @@ -1,5 +1,5 @@ // Copyright 2015 Tim Heckman. All rights reserved. -// Copyright 2018-2024 The Gofrs. All rights reserved. +// Copyright 2018-2025 The Gofrs. All rights reserved. // Use of this source code is governed by the BSD 3-Clause // license that can be found in the LICENSE file. diff --git a/vendor/github.com/gofrs/flock/flock_windows.go b/vendor/github.com/gofrs/flock/flock_windows.go index dfd31e15f..aa144f156 100644 --- a/vendor/github.com/gofrs/flock/flock_windows.go +++ b/vendor/github.com/gofrs/flock/flock_windows.go @@ -1,5 +1,5 @@ // Copyright 2015 Tim Heckman. All rights reserved. -// Copyright 2018-2024 The Gofrs. All rights reserved. +// Copyright 2018-2025 The Gofrs. All rights reserved. // Use of this source code is governed by the BSD 3-Clause // license that can be found in the LICENSE file. @@ -23,6 +23,8 @@ const winLockfileSharedLock = 0x00000000 // ErrorLockViolation is the error code returned from the Windows syscall when a lock would block, // and you ask to fail immediately. +// +//nolint:errname // It should be renamed to `ErrLockViolation`. const ErrorLockViolation windows.Errno = 0x21 // 33 // Lock is a blocking call to try and take an exclusive file lock. diff --git a/vendor/github.com/longhorn/go-iscsi-helper/iscsi/initiator.go b/vendor/github.com/longhorn/go-iscsi-helper/iscsi/initiator.go index 49be2c6aa..791dbd923 100644 --- a/vendor/github.com/longhorn/go-iscsi-helper/iscsi/initiator.go +++ b/vendor/github.com/longhorn/go-iscsi-helper/iscsi/initiator.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" lhns "github.com/longhorn/go-common-libs/ns" diff --git a/vendor/github.com/longhorn/go-iscsi-helper/iscsi/target.go b/vendor/github.com/longhorn/go-iscsi-helper/iscsi/target.go index 3e0c1936c..4708da307 100644 --- a/vendor/github.com/longhorn/go-iscsi-helper/iscsi/target.go +++ b/vendor/github.com/longhorn/go-iscsi-helper/iscsi/target.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" lhexec "github.com/longhorn/go-common-libs/exec" diff --git a/vendor/github.com/longhorn/go-iscsi-helper/iscsidev/iscsi.go b/vendor/github.com/longhorn/go-iscsi-helper/iscsidev/iscsi.go index c9b1bc191..64f10bcd6 100644 --- a/vendor/github.com/longhorn/go-iscsi-helper/iscsidev/iscsi.go +++ b/vendor/github.com/longhorn/go-iscsi-helper/iscsidev/iscsi.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/longhorn/go-iscsi-helper/iscsi" diff --git a/vendor/github.com/longhorn/go-iscsi-helper/longhorndev/dev.go b/vendor/github.com/longhorn/go-iscsi-helper/longhorndev/dev.go index 178073821..1d45b54c6 100644 --- a/vendor/github.com/longhorn/go-iscsi-helper/longhorndev/dev.go +++ b/vendor/github.com/longhorn/go-iscsi-helper/longhorndev/dev.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/longhorn/go-iscsi-helper/iscsidev" diff --git a/vendor/github.com/longhorn/go-iscsi-helper/util/util.go b/vendor/github.com/longhorn/go-iscsi-helper/util/util.go index a51a2b707..53a38931b 100644 --- a/vendor/github.com/longhorn/go-iscsi-helper/util/util.go +++ b/vendor/github.com/longhorn/go-iscsi-helper/util/util.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/controller/client/controller_client.go b/vendor/github.com/longhorn/longhorn-engine/pkg/controller/client/controller_client.go index ced5c9e78..c2f469a88 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/controller/client/controller_client.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/controller/client/controller_client.go @@ -6,7 +6,7 @@ import ( "github.com/sirupsen/logrus" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go index 4ffe1cde7..2a1a289a7 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go @@ -6,13 +6,14 @@ import ( "os" "sync" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" btypes "github.com/longhorn/backupstore/types" butil "github.com/longhorn/backupstore/util" "github.com/longhorn/longhorn-engine/pkg/backingfile" + diskutil "github.com/longhorn/longhorn-engine/pkg/util/disk" ) diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/client/client.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/client/client.go index 8cdfded92..08a72cdd4 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/client/client.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/client/client.go @@ -6,8 +6,7 @@ import ( "strconv" "time" - "github.com/longhorn/types/pkg/generated/enginerpc" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -16,6 +15,8 @@ import ( "github.com/longhorn/longhorn-engine/pkg/interceptor" "github.com/longhorn/longhorn-engine/pkg/types" "github.com/longhorn/longhorn-engine/pkg/util" + + "github.com/longhorn/types/pkg/generated/enginerpc" ) const ( diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/diff_disk.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/diff_disk.go index 572845d67..98f4efcf9 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/diff_disk.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/diff_disk.go @@ -5,7 +5,7 @@ import ( "io" "sync" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/rancher/go-fibmap" diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/hash.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/hash.go index 8d1430210..fe81b4ebd 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/hash.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/hash.go @@ -15,14 +15,16 @@ import ( "syscall" "time" + "github.com/cockroachdb/errors" "github.com/gofrs/flock" - "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/longhorn/sparse-tools/sparse" + xattrType "github.com/longhorn/sparse-tools/types" "github.com/longhorn/longhorn-engine/pkg/types" + diskutil "github.com/longhorn/longhorn-engine/pkg/util/disk" ) diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/replica.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/replica.go index 94025c8bc..0005c2cd6 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/replica.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/replica.go @@ -15,15 +15,17 @@ import ( "sync/atomic" "syscall" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/rancher/go-fibmap" "github.com/sirupsen/logrus" + "github.com/longhorn/sparse-tools/sparse" + "github.com/longhorn/longhorn-engine/pkg/backingfile" "github.com/longhorn/longhorn-engine/pkg/types" "github.com/longhorn/longhorn-engine/pkg/util" + diskutil "github.com/longhorn/longhorn-engine/pkg/util/disk" - "github.com/longhorn/sparse-tools/sparse" ) const ( diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/restore.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/restore.go index 7b0189096..ad1f60649 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/restore.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/restore.go @@ -5,7 +5,7 @@ import ( "os" "sync" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" ) diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/revision_counter.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/revision_counter.go index dc9514eec..348e97af0 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/revision_counter.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/revision_counter.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/longhorn/sparse-tools/sparse" ) diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/sync/backup.go b/vendor/github.com/longhorn/longhorn-engine/pkg/sync/backup.go index 2a748d9e2..1430b78c5 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/sync/backup.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/sync/backup.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "github.com/longhorn/backupstore" diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/sync/sync.go b/vendor/github.com/longhorn/longhorn-engine/pkg/sync/sync.go index 83036806b..352e3e067 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/sync/sync.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/sync/sync.go @@ -7,15 +7,17 @@ import ( "strings" "sync" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" + "github.com/longhorn/types/pkg/generated/enginerpc" + "github.com/longhorn/longhorn-engine/pkg/controller/client" "github.com/longhorn/longhorn-engine/pkg/replica" - replicaClient "github.com/longhorn/longhorn-engine/pkg/replica/client" "github.com/longhorn/longhorn-engine/pkg/types" + + replicaClient "github.com/longhorn/longhorn-engine/pkg/replica/client" diskutil "github.com/longhorn/longhorn-engine/pkg/util/disk" - "github.com/longhorn/types/pkg/generated/enginerpc" ) type Task struct { diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/util/fsfreeze.go b/vendor/github.com/longhorn/longhorn-engine/pkg/util/fsfreeze.go index 64028365a..2d30c5ca0 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/util/fsfreeze.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/util/fsfreeze.go @@ -6,13 +6,14 @@ import ( "strings" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" "k8s.io/mount-utils" - lhexec "github.com/longhorn/go-common-libs/exec" "github.com/longhorn/go-common-libs/types" "github.com/longhorn/go-iscsi-helper/longhorndev" + + lhexec "github.com/longhorn/go-common-libs/exec" ) const ( diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/client.go b/vendor/github.com/longhorn/sparse-tools/sparse/client.go index b2e047afd..ad2af965d 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/client.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/client.go @@ -13,7 +13,8 @@ import ( "sync" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" + log "github.com/sirupsen/logrus" "github.com/longhorn/sparse-tools/types" @@ -114,7 +115,9 @@ func SyncFile(localPath string, remote string, httpClientTimeout int, directIO, log.WithError(err).Errorf("Failed to open local source file %v", localPath) return err } - defer fileIo.Close() + defer func() { + _ = fileIo.Close() + }() return SyncContent(fileIo.Name(), fileIo, fileSize, remote, httpClientTimeout, directIO, fastSync) } @@ -250,7 +253,9 @@ func getLocalDiskFileChangeTimeAndChecksum(sourceName string) (recordedChangeTim if err != nil { return "", "", "", errors.Wrap(err, "failed to open checksum file") } - defer f.Close() + defer func() { + _ = f.Close() + }() data, err := io.ReadAll(f) if err != nil { diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/file.go b/vendor/github.com/longhorn/sparse-tools/sparse/file.go index 17624bd6a..a6c15d322 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/file.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/file.go @@ -10,7 +10,8 @@ import ( "time" "unsafe" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" + log "github.com/sirupsen/logrus" ) @@ -69,7 +70,7 @@ func (file *BufferedFileIoProcessor) GetDataLayout(ctx context.Context) (<-chan } func (file *BufferedFileIoProcessor) Size() (int64, error) { - info, err := file.File.Stat() + info, err := file.Stat() if err != nil { return 0, err } @@ -77,7 +78,7 @@ func (file *BufferedFileIoProcessor) Size() (int64, error) { } func (file *BufferedFileIoProcessor) Close() error { - if err := file.File.Sync(); err != nil { + if err := file.Sync(); err != nil { return err } return file.File.Close() @@ -156,7 +157,7 @@ func (file *DirectFileIoProcessor) GetDataLayout(ctx context.Context) (<-chan Fi } func (file *DirectFileIoProcessor) Size() (int64, error) { - info, err := file.File.Stat() + info, err := file.Stat() if err != nil { return 0, err } diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/local.go b/vendor/github.com/longhorn/sparse-tools/sparse/local.go index 84085904c..c381c01dc 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/local.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/local.go @@ -6,7 +6,7 @@ import ( "os" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" "github.com/sirupsen/logrus" ) @@ -83,14 +83,14 @@ func newSyncLocal(sourceFilePath, targetFilePath string, fileSize, syncBatchSize targetFileIo, err := NewDirectFileIoProcessor(targetFilePath, os.O_RDWR|os.O_CREATE, 0) if err != nil { - sourceFileIo.Close() + _ = sourceFileIo.Close() return nil, err } err = targetFileIo.Truncate(fileSize) if err != nil { - sourceFileIo.Close() - targetFileIo.Close() + _ = sourceFileIo.Close() + _ = targetFileIo.Close() return nil, err } @@ -104,8 +104,8 @@ func newSyncLocal(sourceFilePath, targetFilePath string, fileSize, syncBatchSize } func (local *syncLocal) close() { - local.sourceFileIo.Close() - local.targetFileIo.Close() + _ = local.sourceFileIo.Close() + _ = local.targetFileIo.Close() } func (local *syncLocal) syncContent() error { diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go b/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go index 480e59da1..2fd2ccfe7 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go @@ -8,7 +8,8 @@ import ( "sync/atomic" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" + log "github.com/sirupsen/logrus" ) @@ -47,13 +48,17 @@ func FoldFile(childFileName, parentFileName string, ops FileHandlingOperations) if err != nil { return errors.Wrap(err, "failed to open childFile") } - defer childFileIo.Close() + defer func() { + _ = childFileIo.Close() + }() parentFileIo, err := NewDirectFileIoProcessor(parentFileName, os.O_WRONLY, 0) if err != nil { return errors.Wrap(err, "failed to open parentFile") } - defer parentFileIo.Close() + defer func() { + _ = parentFileIo.Close() + }() return coalesce(parentFileIo, childFileIo, childFInfo.Size(), ops) } diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go b/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go index 3940b51ca..02fbe4f05 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go @@ -8,7 +8,8 @@ import ( "sync/atomic" "time" - "github.com/pkg/errors" + "github.com/cockroachdb/errors" + log "github.com/sirupsen/logrus" ) @@ -43,13 +44,17 @@ func PruneFile(parentFileName, childFileName string, ops FileHandlingOperations) if err != nil { return errors.Wrapf(err, "failed to open child file %v", childFileName) } - defer childFileIo.Close() + defer func() { + _ = childFileIo.Close() + }() parentFileIo, err := NewDirectFileIoProcessor(parentFileName, os.O_RDWR, 0) if err != nil { return errors.Wrapf(err, "failed to open parent file %v", parentFileName) } - defer parentFileIo.Close() + defer func() { + _ = parentFileIo.Close() + }() return prune(parentFileIo, childFileIo, childFInfo.Size(), ops) } diff --git a/vendor/github.com/longhorn/sparse-tools/util/hash.go b/vendor/github.com/longhorn/sparse-tools/util/hash.go index f21c8c8dd..2e14184d3 100644 --- a/vendor/github.com/longhorn/sparse-tools/util/hash.go +++ b/vendor/github.com/longhorn/sparse-tools/util/hash.go @@ -23,7 +23,9 @@ func GetSnapshotHashInfoFromChecksumFile(checksumFileName string) (*types.Snapsh if err != nil { return nil, err } - defer f.Close() + defer func() { + _ = f.Close() + }() var info types.SnapshotHashInfo @@ -51,7 +53,9 @@ func encodeToFile(obj interface{}, path string) (err error) { if err != nil { return err } - defer f.Close() + defer func() { + _ = f.Close() + }() if err := json.NewEncoder(f).Encode(&obj); err != nil { return err diff --git a/vendor/modules.txt b/vendor/modules.txt index e2ef2dc3e..7ef68e25a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -194,8 +194,8 @@ github.com/go-openapi/jsonreference/internal # github.com/go-openapi/swag v0.23.0 ## explicit; go 1.20 github.com/go-openapi/swag -# github.com/gofrs/flock v0.12.1 -## explicit; go 1.21.0 +# github.com/gofrs/flock v0.13.0 +## explicit; go 1.24.0 github.com/gofrs/flock # github.com/gogo/protobuf v1.3.2 ## explicit; go 1.15 @@ -264,8 +264,8 @@ github.com/longhorn/go-common-libs/sync github.com/longhorn/go-common-libs/sys github.com/longhorn/go-common-libs/types github.com/longhorn/go-common-libs/utils -# github.com/longhorn/go-iscsi-helper v0.0.0-20250810143507-5c5f9a0060b4 -## explicit; go 1.23.0 +# github.com/longhorn/go-iscsi-helper v0.0.0-20251009073425-68f54afcf47e +## explicit; go 1.24.0 github.com/longhorn/go-iscsi-helper/iscsi github.com/longhorn/go-iscsi-helper/iscsidev github.com/longhorn/go-iscsi-helper/longhorndev @@ -280,7 +280,7 @@ github.com/longhorn/go-spdk-helper/pkg/spdk/setup github.com/longhorn/go-spdk-helper/pkg/spdk/types github.com/longhorn/go-spdk-helper/pkg/types github.com/longhorn/go-spdk-helper/pkg/util -# github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20250911042227-b892286beabd +# github.com/longhorn/longhorn-engine v1.10.0-dev-20250824.0.20251020071219-064944a97ca5 ## explicit; go 1.24.0 github.com/longhorn/longhorn-engine/pkg/backingfile github.com/longhorn/longhorn-engine/pkg/controller/client @@ -307,8 +307,8 @@ github.com/longhorn/longhorn-spdk-engine/pkg/spdk/disk/virtio-scsi github.com/longhorn/longhorn-spdk-engine/pkg/types github.com/longhorn/longhorn-spdk-engine/pkg/util github.com/longhorn/longhorn-spdk-engine/pkg/util/broadcaster -# github.com/longhorn/sparse-tools v0.0.0-20250826041019-4aae87cb253a -## explicit; go 1.22.0 +# github.com/longhorn/sparse-tools v0.0.0-20251020055717-ae3aca526fd7 +## explicit; go 1.24.0 github.com/longhorn/sparse-tools/sparse github.com/longhorn/sparse-tools/types github.com/longhorn/sparse-tools/util