diff --git a/cmd/reva/transfer-cancel.go b/cmd/reva/transfer-cancel.go index 2eede16952a..dfa086467ba 100644 --- a/cmd/reva/transfer-cancel.go +++ b/cmd/reva/transfer-cancel.go @@ -34,11 +34,11 @@ func transferCancelCommand() *command { cmd := newCommand("transfer-cancel") cmd.Description = func() string { return "cancel a running transfer" } cmd.Usage = func() string { return "Usage: transfer-cancel [-flags]" } - txId := cmd.String("txId", "", "the transfer identifier") + txID := cmd.String("txId", "", "the transfer identifier") cmd.Action = func(w ...io.Writer) error { // validate flags - if *txId == "" { + if *txID == "" { return errors.New("txId must be specified: use -txId flag\n" + cmd.Usage()) } @@ -49,7 +49,7 @@ func transferCancelCommand() *command { } cancelRequest := &datatx.CancelTransferRequest{ - TxId: &datatx.TxId{OpaqueId: *txId}, + TxId: &datatx.TxId{OpaqueId: *txID}, } cancelResponse, err := client.CancelTransfer(ctx, cancelRequest) diff --git a/cmd/reva/transfer-get-status.go b/cmd/reva/transfer-get-status.go index 0fd9f74a7d4..ab73a52e699 100644 --- a/cmd/reva/transfer-get-status.go +++ b/cmd/reva/transfer-get-status.go @@ -34,11 +34,11 @@ func transferGetStatusCommand() *command { cmd := newCommand("transfer-get-status") cmd.Description = func() string { return "get the status of a transfer" } cmd.Usage = func() string { return "Usage: transfer-get-status [-flags]" } - txId := cmd.String("txId", "", "the transfer identifier") + txID := cmd.String("txId", "", "the transfer identifier") cmd.Action = func(w ...io.Writer) error { // validate flags - if *txId == "" { + if *txID == "" { return errors.New("txId must be specified: use -txId flag\n" + cmd.Usage()) } @@ -49,7 +49,7 @@ func transferGetStatusCommand() *command { } getStatusRequest := &datatx.GetTransferStatusRequest{ - TxId: &datatx.TxId{OpaqueId: *txId}, + TxId: &datatx.TxId{OpaqueId: *txID}, } getStatusResponse, err := client.GetTransferStatus(ctx, getStatusRequest) diff --git a/cmd/reva/transfer-list.go b/cmd/reva/transfer-list.go index f11721ee107..b0ea83ae9dc 100644 --- a/cmd/reva/transfer-list.go +++ b/cmd/reva/transfer-list.go @@ -33,7 +33,7 @@ func transferListCommand() *command { cmd := newCommand("transfer-list") cmd.Description = func() string { return "get a list of transfers" } cmd.Usage = func() string { return "Usage: transfer-list [-flags]" } - filterShareId := cmd.String("shareId", "", "share ID filter (optional)") + filterShareID := cmd.String("shareId", "", "share ID filter (optional)") cmd.Action = func(w ...io.Writer) error { ctx := getAuthContext() @@ -44,12 +44,12 @@ func transferListCommand() *command { // validate flags var filters []*datatx.ListTransfersRequest_Filter - if *filterShareId != "" { + if *filterShareID != "" { filters = append(filters, &datatx.ListTransfersRequest_Filter{ Type: datatx.ListTransfersRequest_Filter_TYPE_SHARE_ID, Term: &datatx.ListTransfersRequest_Filter_ShareId{ ShareId: &ocm.ShareId{ - OpaqueId: *filterShareId, + OpaqueId: *filterShareID, }, }, }) diff --git a/cmd/reva/transfer-retry.go b/cmd/reva/transfer-retry.go index cc3e1643a10..2f2ada08d9c 100644 --- a/cmd/reva/transfer-retry.go +++ b/cmd/reva/transfer-retry.go @@ -34,11 +34,11 @@ func transferRetryCommand() *command { cmd := newCommand("transfer-retry") cmd.Description = func() string { return "retry a transfer" } cmd.Usage = func() string { return "Usage: transfer-retry [-flags]" } - txId := cmd.String("txId", "", "the transfer identifier") + txID := cmd.String("txId", "", "the transfer identifier") cmd.Action = func(w ...io.Writer) error { // validate flags - if *txId == "" { + if *txID == "" { return errors.New("txId must be specified: use -txId flag\n" + cmd.Usage()) } @@ -50,7 +50,7 @@ func transferRetryCommand() *command { retryRequest := &datatx.RetryTransferRequest{ TxId: &datatx.TxId{ - OpaqueId: *txId, + OpaqueId: *txID, }, } diff --git a/pkg/datatx/datatx.go b/pkg/datatx/datatx.go index 945479d23bf..3b1d98d6b21 100644 --- a/pkg/datatx/datatx.go +++ b/pkg/datatx/datatx.go @@ -29,10 +29,10 @@ type Manager interface { // StartTransfer initiates a transfer job and returns a TxInfo object including a unique transfer id, and error if any. StartTransfer(ctx context.Context, srcRemote string, srcPath string, srcToken string, destRemote string, destPath string, destToken string) (*datatx.TxInfo, error) // GetTransferStatus returns a TxInfo object including the current status, and error if any. - GetTransferStatus(ctx context.Context, transferId string) (*datatx.TxInfo, error) + GetTransferStatus(ctx context.Context, transferID string) (*datatx.TxInfo, error) // CancelTransfer cancels the transfer and returns a TxInfo object and error if any. - CancelTransfer(ctx context.Context, transferId string) (*datatx.TxInfo, error) + CancelTransfer(ctx context.Context, transferID string) (*datatx.TxInfo, error) // RetryTransfer retries the transfer and returns a TxInfo object and error if any. // Note that tokens must still be valid. - RetryTransfer(ctx context.Context, transferId string) (*datatx.TxInfo, error) + RetryTransfer(ctx context.Context, transferID string) (*datatx.TxInfo, error) } diff --git a/pkg/datatx/manager/rclone/rclone.go b/pkg/datatx/manager/rclone/rclone.go index f977c00217c..f25624af46b 100644 --- a/pkg/datatx/manager/rclone/rclone.go +++ b/pkg/datatx/manager/rclone/rclone.go @@ -75,7 +75,7 @@ type rclone struct { pDriver *pDriver } -type rcloneHttpErrorRes struct { +type rcloneHTTPErrorRes struct { Error string `json:"error"` Input map[string]interface{} `json:"input"` Path string `json:"path"` @@ -212,27 +212,27 @@ func (driver *rclone) StartTransfer(ctx context.Context, srcRemote string, srcPa return driver.startJob(ctx, "", srcRemote, srcPath, srcToken, destRemote, destPath, destToken) } -// startJob starts a transfer job. Retries a previous job if transferId is specified. -func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote string, srcPath string, srcToken string, destRemote string, destPath string, destToken string) (*datatx.TxInfo, error) { +// startJob starts a transfer job. Retries a previous job if transferID is specified. +func (driver *rclone) startJob(ctx context.Context, transferID string, srcRemote string, srcPath string, srcToken string, destRemote string, destPath string, destToken string) (*datatx.TxInfo, error) { logger := appctx.GetLogger(ctx) driver.pDriver.Lock() defer driver.pDriver.Unlock() - var txId string + var txID string var cTime *typespb.Timestamp - if transferId == "" { - txId = uuid.New().String() + if transferID == "" { + txID = uuid.New().String() cTime = &typespb.Timestamp{Seconds: uint64(time.Now().Unix())} - } else { // restart existing transfer if transferId is specified - logger.Debug().Msgf("Restarting transfer (txId: %s)", transferId) - txId = transferId - transfer, err := driver.pDriver.model.getTransfer(txId) + } else { // restart existing transfer if transferID is specified + logger.Debug().Msgf("Restarting transfer (txID: %s)", transferID) + txID = transferID + transfer, err := driver.pDriver.model.getTransfer(txID) if err != nil { - err = errors.Wrap(err, "rclone: error retrying transfer (transferId: "+txId+")") + err = errors.Wrap(err, "rclone: error retrying transfer (transferID: "+txID+")") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: nil, }, err @@ -243,7 +243,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote if !endStatusFound { err := errors.New("rclone: transfer still running, unable to restart") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, err @@ -254,13 +254,13 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote destToken = transfer.DestToken destRemote = transfer.DestRemote destPath = transfer.DestPath - delete(driver.pDriver.model.Transfers, txId) + delete(driver.pDriver.model.Transfers, txID) } transferStatus := datatx.Status_STATUS_TRANSFER_NEW transfer := &transfer{ - TransferID: txId, + TransferID: txID, JobID: int64(-1), TransferStatus: transferStatus, SrcToken: srcToken, @@ -272,7 +272,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote Ctime: fmt.Sprint(cTime.Seconds), // TODO do we need nanos here? } - driver.pDriver.model.Transfers[txId] = transfer + driver.pDriver.model.Transfers[txID] = transfer type rcloneAsyncReqJSON struct { SrcFs string `json:"srcFs"` @@ -293,7 +293,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error pulling transfer: error marshalling rclone req data") transfer.TransferStatus = datatx.Status_STATUS_INVALID return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -305,17 +305,16 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error pulling transfer: error stating src path") transfer.TransferStatus = datatx.Status_STATUS_INVALID return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) } if !remotePathIsFolder { - transferFileMethod = "/operations/copyfile" err = errors.Wrap(err, "rclone: error pulling transfer: path is a file, only folder transfer is implemented") transfer.TransferStatus = datatx.Status_STATUS_INVALID return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -326,7 +325,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error pulling transfer: error parsing driver endpoint") transfer.TransferStatus = datatx.Status_STATUS_INVALID return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -338,7 +337,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error pulling transfer: error framing post request") transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_FAILED return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -351,7 +350,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error pulling transfer: error sending post request") transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_FAILED return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -360,12 +359,12 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote defer res.Body.Close() if res.StatusCode != http.StatusOK { - var errorResData rcloneHttpErrorRes + var errorResData rcloneHTTPErrorRes if err = json.NewDecoder(res.Body).Decode(&errorResData); err != nil { err = errors.Wrap(err, "rclone driver: error decoding response data") transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_FAILED return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -373,7 +372,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote e := errors.New("rclone: rclone request responded with error, " + fmt.Sprintf(" status: %v, error: %v", errorResData.Status, errorResData.Error)) transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_FAILED return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, driver.pDriver.model.saveTransfer(e) @@ -387,7 +386,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote err = errors.Wrap(err, "rclone: error decoding response data") transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_FAILED return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transfer.TransferStatus, Ctime: cTime, }, driver.pDriver.model.saveTransfer(err) @@ -398,7 +397,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote if err := driver.pDriver.model.saveTransfer(nil); err != nil { err = errors.Wrap(err, "rclone: error pulling transfer") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: datatx.Status_STATUS_INVALID, Ctime: cTime, }, err @@ -414,11 +413,11 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote defer driver.pDriver.Unlock() for { - transfer, err := driver.pDriver.model.getTransfer(txId) + transfer, err := driver.pDriver.model.getTransfer(txID) if err != nil { transfer.TransferStatus = datatx.Status_STATUS_INVALID err = driver.pDriver.model.saveTransfer(err) - logger.Error().Err(err).Msgf("rclone driver: unable to retrieve transfer with id: %v", txId) + logger.Error().Err(err).Msgf("rclone driver: unable to retrieve transfer with id: %v", txID) break } @@ -488,7 +487,7 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote defer res.Body.Close() if res.StatusCode != http.StatusOK { - var errorResData rcloneHttpErrorRes + var errorResData rcloneHTTPErrorRes if err = json.NewDecoder(res.Body).Decode(&errorResData); err != nil { err = errors.Wrap(err, "rclone driver: error decoding response data") logger.Error().Err(err).Msgf("rclone driver: error reading response body: %v", err) @@ -562,36 +561,36 @@ func (driver *rclone) startJob(ctx context.Context, transferId string, srcRemote }() return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: txId}, + Id: &datatx.TxId{OpaqueId: txID}, Status: transferStatus, Ctime: cTime, }, nil } // GetTransferStatus returns the status of the transfer with the specified job id -func (driver *rclone) GetTransferStatus(ctx context.Context, transferId string) (*datatx.TxInfo, error) { - transfer, err := driver.pDriver.model.getTransfer(transferId) +func (driver *rclone) GetTransferStatus(ctx context.Context, transferID string) (*datatx.TxInfo, error) { + transfer, err := driver.pDriver.model.getTransfer(transferID) if err != nil { return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: nil, }, err } cTime, _ := strconv.ParseInt(transfer.Ctime, 10, 64) return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: transfer.TransferStatus, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, nil } // CancelTransfer cancels the transfer with the specified transfer id -func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*datatx.TxInfo, error) { - transfer, err := driver.pDriver.model.getTransfer(transferId) +func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*datatx.TxInfo, error) { + transfer, err := driver.pDriver.model.getTransfer(transferID) if err != nil { return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: nil, }, err @@ -601,7 +600,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if endStatusFound { err := errors.New("rclone driver: transfer already in end state") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -619,7 +618,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if err != nil { err = errors.Wrap(err, "rclone driver: error marshalling rclone req data") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -631,7 +630,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if err != nil { err = errors.Wrap(err, "rclone driver: error parsing driver endpoint") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -643,7 +642,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if err != nil { err = errors.Wrap(err, "rclone driver: error framing post request") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -656,7 +655,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if err != nil { err = errors.Wrap(err, "rclone driver: error sending post request") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -665,18 +664,18 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d defer res.Body.Close() if res.StatusCode != http.StatusOK { - var errorResData rcloneHttpErrorRes + var errorResData rcloneHTTPErrorRes if err = json.NewDecoder(res.Body).Decode(&errorResData); err != nil { err = errors.Wrap(err, "rclone driver: error decoding response data") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err } - err = errors.Wrap(errors.New(fmt.Sprintf("status: %v, error: %v", errorResData.Status, errorResData.Error)), "rclone driver: rclone request responded with error") + err = errors.Wrap(errors.Errorf("status: %v, error: %v", errorResData.Status, errorResData.Error), "rclone driver: rclone request responded with error") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -698,7 +697,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if err = json.NewDecoder(res.Body).Decode(&resData); err != nil { err = errors.Wrap(err, "rclone driver: error decoding response data") return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err @@ -706,7 +705,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d if resData.Error != "" { return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_TRANSFER_CANCEL_FAILED, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, errors.New(resData.Error) @@ -715,14 +714,14 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d transfer.TransferStatus = datatx.Status_STATUS_TRANSFER_CANCELLED if err := driver.pDriver.model.saveTransfer(nil); err != nil { return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_INVALID, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, err } return &datatx.TxInfo{ - Id: &datatx.TxId{OpaqueId: transferId}, + Id: &datatx.TxId{OpaqueId: transferID}, Status: datatx.Status_STATUS_TRANSFER_CANCELLED, Ctime: &typespb.Timestamp{Seconds: uint64(cTime)}, }, nil @@ -730,13 +729,13 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferId string) (*d // RetryTransfer retries the transfer with the specified transfer ID. // Note that tokens must still be valid. -func (driver *rclone) RetryTransfer(ctx context.Context, transferId string) (*datatx.TxInfo, error) { - return driver.startJob(ctx, transferId, "", "", "", "", "", "") +func (driver *rclone) RetryTransfer(ctx context.Context, transferID string) (*datatx.TxInfo, error) { + return driver.startJob(ctx, transferID, "", "", "", "", "", "") } // getTransfer returns the transfer with the specified transfer ID -func (m *transferModel) getTransfer(transferId string) (*transfer, error) { - transfer, ok := m.Transfers[transferId] +func (m *transferModel) getTransfer(transferID string) (*transfer, error) { + transfer, ok := m.Transfers[transferID] if !ok { return nil, errors.New("rclone driver: invalid transfer ID") } @@ -783,11 +782,11 @@ func (driver *rclone) remotePathIsFolder(remote string, remotePath string, remot defer res.Body.Close() if res.StatusCode != http.StatusOK { - var errorResData rcloneHttpErrorRes + var errorResData rcloneHTTPErrorRes if err = json.NewDecoder(res.Body).Decode(&errorResData); err != nil { return false, errors.Wrap(err, "rclone driver: error decoding response data") } - return false, errors.Wrap(errors.New(fmt.Sprintf("status: %v, error: %v", errorResData.Status, errorResData.Error)), "rclone driver: rclone request responded with error") + return false, errors.Wrap(errors.Errorf("status: %v, error: %v", errorResData.Status, errorResData.Error), "rclone driver: rclone request responded with error") } type item struct {