Skip to content

Commit

Permalink
Enable revive linter and solve issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoguita committed Nov 22, 2022
1 parent b208054 commit b2ccc3d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ linters:
- containedctx # TODO: consider enabling the 'containedctx' linter to detect struct contained context.Context field.
- whitespace # TODO: consider enabling the 'whitespace' linter to detect leading and trailing whitespaces.
- unparam # TODO: consider enabling the 'unparam' linter to report unused function parameters.
- revive # TODO: consider enabling the 'revive' linter to configure custom rules and define a strict preset for enhancing development & code review processes.
- nakedret # TODO: consider enabling the 'nakedret' linter to find naked returns in functions greater than a specified function length.
- dupword # TODO: consider enabling the 'dupword' linter to check for duplicate words in the source code.
- makezero # TODO: consider enabling the 'makezero' linter to find slice declarations with non-zero initial length.
Expand Down
3 changes: 3 additions & 0 deletions changelog/unreleased/enhancement-revive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Enable revive linter in golangci-lint and solve issues

https://github.com/cs3org/reva/pull/3465
2 changes: 1 addition & 1 deletion internal/http/services/ocmd/shares.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (h *sharesHandler) createShare(w http.ResponseWriter, r *http.Request) {
return
}

var shareWithParts []string = strings.Split(shareWith, "@")
var shareWithParts = strings.Split(shareWith, "@")
userRes, err := gatewayClient.GetUser(ctx, &userpb.GetUserRequest{
UserId: &userpb.UserId{OpaqueId: shareWithParts[0]}, SkipFetchingUserGroups: true,
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/provider/wopi/wopi.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
q.Add("appviewurl", viewAppURL)
}
}
var access string = "edit"
var access = "edit"
if resource.GetSize() == 0 {
if _, ok := p.appURLs["editnew"]; ok {
access = "editnew"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/invite/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (m *manager) ForwardInvite(ctx context.Context, invite *invitepb.InviteToke
if e != nil {
return errors.Wrap(e, "json: error reading request body")
}
return errors.Wrap(errors.New(fmt.Sprintf("%s: %s", resp.Status, string(respBody))), "json: error sending accept post request")
return errors.Wrap(fmt.Errorf("%s: %s", resp.Status, string(respBody)), "json: error sending accept post request")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/sysinfo/sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type SystemInformation struct {

var (
// SysInfo provides global system information.
SysInfo *SystemInformation = &SystemInformation{}
SysInfo = &SystemInformation{}
)

// ToJSON converts the system information to JSON.
Expand Down

0 comments on commit b2ccc3d

Please sign in to comment.