mirror of
https://github.com/versity/versitygw.git
synced 2026-09-22 16:04:15 +00:00
Merge pull request #2407 from versity/ben/staticcheck
fix: staticcheck on cuObject stubs
This commit is contained in:
@@ -20,11 +20,13 @@ package cubackend
|
||||
// This file is a stub for platforms without RDMA support.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
|
||||
"github.com/versity/versitygw/backend"
|
||||
)
|
||||
|
||||
var errUnsupportedPlatform = errors.New("cuserver: RDMA backend not supported on this platform")
|
||||
|
||||
// CuServer is a non-functional stub on platforms without RDMA support.
|
||||
type CuServer struct {
|
||||
backend.BackendUnsupported
|
||||
@@ -32,5 +34,5 @@ type CuServer struct {
|
||||
|
||||
// New always returns an unsupported-platform error on this build.
|
||||
func New(opts CuServerOpts, be backend.Backend) (*CuServer, error) {
|
||||
return nil, fmt.Errorf("cuserver: RDMA backend not supported on this platform")
|
||||
return nil, errUnsupportedPlatform
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import (
|
||||
s3lib "github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
)
|
||||
|
||||
var errUnsupportedPlatform = fmt.Errorf("cuobjclient: only supported on linux/amd64 with cgo")
|
||||
|
||||
// Session is a non-Linux stub so packages compile on unsupported platforms.
|
||||
type Session struct{}
|
||||
|
||||
@@ -37,7 +39,7 @@ func NewSession(size int) (*Session, error) {
|
||||
if size > MaxTransferSize {
|
||||
return nil, fmt.Errorf("invalid size %d: exceeds MaxTransferSize (%d)", size, MaxTransferSize)
|
||||
}
|
||||
return nil, fmt.Errorf("cuobjclient: NewSession is only supported on linux/amd64 with cgo and the rdma build tag")
|
||||
return nil, errUnsupportedPlatform
|
||||
}
|
||||
|
||||
// Close is a no-op in the unsupported-platform stub.
|
||||
@@ -52,7 +54,7 @@ func (s *Session) Upload(base *s3lib.Client, bucket, key string, src []byte) err
|
||||
_ = bucket
|
||||
_ = key
|
||||
_ = src
|
||||
return fmt.Errorf("cuobjclient: Upload is only supported on linux/amd64 with cgo and the rdma build tag")
|
||||
return errUnsupportedPlatform
|
||||
}
|
||||
|
||||
// Download always returns an unsupported-platform error on this build.
|
||||
@@ -62,5 +64,5 @@ func (s *Session) Download(base *s3lib.Client, bucket, key string, dst []byte) e
|
||||
_ = bucket
|
||||
_ = key
|
||||
_ = dst
|
||||
return fmt.Errorf("cuobjclient: Download is only supported on linux/amd64 with cgo and the rdma build tag")
|
||||
return errUnsupportedPlatform
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user