Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Sep 3, 2024
1 parent 1ab630e commit a3fdb7a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ toolchain: $(GOLANGCI_LINT) $(CALENS)

$(GOLANGCI_LINT):
@mkdir -p $(@D)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(@D) sh -s v1.54.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(@D) sh -s v1.60.3

CALENS_DIR := $(shell mktemp -d)
$(CALENS):
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/manager/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (am *Manager) do(ctx context.Context, a Action) (int, []byte, error) {

log.Info().Msgf("am.do response %d %s", resp.StatusCode, body)
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return 0, nil, fmt.Errorf("Unexpected response code from EFSS API: " + strconv.Itoa(resp.StatusCode))
return 0, nil, fmt.Errorf("Unexpected response code from EFSS API: %s", strconv.Itoa(resp.StatusCode))
}
return resp.StatusCode, body, nil
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/datatx/manager/rclone/rclone.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d

_, endStatusFound := txEndStatuses[job.TransferStatus.String()]
if endStatusFound {
err := errors.Wrapf(errors.New("rclone driver: job already in end state"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: job already in end state"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand All @@ -649,7 +649,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d

data, err := json.Marshal(rcloneCancelTransferReq)
if err != nil {
err := errors.Wrapf(errors.New("rclone driver: error marshalling rclone job/stop req data"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error marshalling rclone job/stop req data"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand All @@ -661,7 +661,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d

u, err := url.Parse(driver.config.Endpoint)
if err != nil {
err := errors.Wrapf(errors.New("rclone driver: error parsing driver endpoint"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error parsing driver endpoint"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand All @@ -673,7 +673,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d

req, err := http.NewRequest(http.MethodPost, requestURL, bytes.NewReader(data))
if err != nil {
err := errors.Wrapf(errors.New("rclone driver: error framing post request"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error framing post request"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand All @@ -686,7 +686,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d

res, err := driver.client.Do(req)
if err != nil {
err := errors.Wrapf(errors.New("rclone driver: error sending post request"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error sending post request"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand All @@ -699,7 +699,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d
if res.StatusCode != http.StatusOK {
var errorResData rcloneHTTPErrorRes
if err = json.NewDecoder(res.Body).Decode(&errorResData); err != nil {
err := errors.Wrapf(errors.New("rclone driver: error decoding response data"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error decoding response data"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand Down Expand Up @@ -728,7 +728,7 @@ func (driver *rclone) CancelTransfer(ctx context.Context, transferID string) (*d
}
var resData rcloneCancelTransferResJSON
if err = json.NewDecoder(res.Body).Decode(&resData); err != nil {
err := errors.Wrapf(errors.New("rclone driver: error decoding response data"), transferRemovedMessage)
err := errors.Wrap(errors.New("rclone driver: error decoding response data"), transferRemovedMessage)
return &datatx.TxInfo{
Id: &datatx.TxId{OpaqueId: transferID},
Status: datatx.Status_STATUS_INVALID,
Expand Down
12 changes: 6 additions & 6 deletions pkg/ocm/invite/repository/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (c *Client) doPostToken(token string, initiator string, description string,
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return false, fmt.Errorf("Unexpected response code from EFSS API: " + strconv.Itoa(resp.StatusCode))
return false, fmt.Errorf("Unexpected response code from EFSS API: %s", strconv.Itoa(resp.StatusCode))
}
return true, nil
}
Expand All @@ -185,7 +185,7 @@ func (c *Client) doGetToken(token string) (*apiToken, error) {
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Unexpected response code from API: " + strconv.Itoa(resp.StatusCode))
return nil, fmt.Errorf("Unexpected response code from API: %s", strconv.Itoa(resp.StatusCode))
}

result := &apiToken{}
Expand Down Expand Up @@ -218,7 +218,7 @@ func (c *Client) doGetAllTokens(initiator string) ([]*apiToken, error) {
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Unexpected response code from API: " + strconv.Itoa(resp.StatusCode))
return nil, fmt.Errorf("Unexpected response code from API: %s", strconv.Itoa(resp.StatusCode))
}

result := []*apiToken{}
Expand Down Expand Up @@ -257,7 +257,7 @@ func (c *Client) doPostRemoteUser(initiator string, opaqueUserID string, idp str

defer resp.Body.Close()
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return false, fmt.Errorf("Unexpected response code from EFSS API: " + strconv.Itoa(resp.StatusCode))
return false, fmt.Errorf("Unexpected response code from EFSS API: %s", strconv.Itoa(resp.StatusCode))
}
return true, nil
}
Expand All @@ -282,7 +282,7 @@ func (c *Client) doGetRemoteUser(initiator string, opaqueUserID string, idp stri
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Unexpected response code from API: " + strconv.Itoa(resp.StatusCode))
return nil, fmt.Errorf("Unexpected response code from API: %s", strconv.Itoa(resp.StatusCode))
}

result := &apiOCMUser{}
Expand Down Expand Up @@ -315,7 +315,7 @@ func (c *Client) doGetAllRemoteUsers(initiator string, search string) ([]*apiOCM
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Unexpected response code from API: " + strconv.Itoa(resp.StatusCode))
return nil, fmt.Errorf("Unexpected response code from API: %s", strconv.Itoa(resp.StatusCode))
}

result := []*apiOCMUser{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/share/repository/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func (sm *Manager) do(ctx context.Context, a Action, username string) (int, []by
log.Info().Int("status", resp.StatusCode).Msgf("sent request to EFSS API, response: %s", body)

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return 0, nil, fmt.Errorf("Unexpected response from EFSS API: " + strconv.Itoa(resp.StatusCode))
return 0, nil, fmt.Errorf("Unexpected response from EFSS API: %s", strconv.Itoa(resp.StatusCode))
}
return resp.StatusCode, body, nil
}
2 changes: 1 addition & 1 deletion pkg/user/manager/ldap/ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ func TestUserManager(t *testing.T) {
// positive tests for New
_, err = New(context.Background(), map[string]interface{}{})
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
}
2 changes: 1 addition & 1 deletion pkg/user/manager/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (um *Manager) do(ctx context.Context, a Action, username string) (int, []by
body, err := io.ReadAll(resp.Body)
log.Info().Msgf("um.do res %s %s", url, string(body))
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return 0, nil, fmt.Errorf("Unexpected response code from EFSS API: " + strconv.Itoa(resp.StatusCode))
return 0, nil, fmt.Errorf("Unexpected response code from EFSS API: %s", strconv.Itoa(resp.StatusCode))
}
return resp.StatusCode, body, err
}
Expand Down

0 comments on commit a3fdb7a

Please sign in to comment.