Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace deprecated linter modules #2589

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ issues:
- scopelint
linters:
enable:
- maligned
- bodyclose
- deadcode
- errcheck
Expand All @@ -27,10 +26,10 @@ linters:
- unused
- varcheck
- depguard
- golint
- revive
- goimports
- unconvert
- scopelint
- exportloopref
- misspell
- gocritic
- prealloc
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/update-linter-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Change: Remove deprecated linter modules

Replaced the deprecated linter modules with the recommended ones.

https://github.com/cs3org/reva/pull/2589
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *service) CreateOCMShare(ctx context.Context, req *ocm.CreateOCMShareReq
// token = protocol FIXME!
}

var sharedSecret string = ""
var sharedSecret string
share, err := s.sm.Share(ctx, req.ResourceId, req.Grant, name, req.RecipientMeshProvider, permissions, nil, sharedSecret, sharetype)

if err != nil {
Expand Down
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, "@")
shareWithParts := strings.Split(shareWith, "@")
userRes, err := gatewayClient.GetUser(ctx, &userpb.GetUserRequest{
UserId: &userpb.UserId{OpaqueId: shareWithParts[0]},
})
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 @@ -246,7 +246,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/ocm/share/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Send(requestBodyMap map[string]interface{}, pi *ocmprovider.ProviderInfo) e
e = errors.Wrap(e, "sender: error reading request body")
return e
}
err = errors.Wrap(errors.New(fmt.Sprintf("%s: %s", resp.Status, string(respBody))), "sender: error sending create ocm core share post request")
err = errors.Wrap(fmt.Errorf("%s: %s", resp.Status, string(respBody)), "sender: error sending create ocm core share post request")
return err
}
return nil
Expand Down
20 changes: 13 additions & 7 deletions pkg/storage/utils/decomposedfs/xattrs/xattrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ func CopyMetadata(src, target string, filter func(attributeName string) bool) (e

// error handling: We count errors of reads or writes of xattrs.
// if there were any read or write errors an error is returned.
var xerrs int = 0
var xerr error
var (
xerrs = 0
xerr error
)
for idx := range attrNameList {
attrName := attrNameList[idx]
if filter == nil || filter(attrName) {
Expand All @@ -173,7 +175,7 @@ func CopyMetadata(src, target string, filter func(attributeName string) bool) (e
}
}
if xerrs > 0 {
err = errors.Wrap(xerr, "Failed to copy all xattrs, last error returned.")
err = errors.Wrap(xerr, "failed to copy all xattrs, last error returned")
}

return err
Expand Down Expand Up @@ -215,8 +217,10 @@ func SetMultiple(filePath string, attribs map[string]string) (err error) {

// error handling: Count if there are errors while setting the attribs.
// if there were any, return an error.
var xerrs int = 0
var xerr error
var (
xerrs = 0
xerr error
)
for key, val := range attribs {
if xerr = xattr.Set(filePath, key, []byte(val)); xerr != nil {
// log
Expand Down Expand Up @@ -278,8 +282,10 @@ func All(filePath string) (attribs map[string]string, err error) {
return nil, err
}

var xerrs int = 0
var xerr error
var (
xerrs = 0
xerr error
)
// error handling: Count if there are errors while reading all attribs.
// if there were any, return an error.
attribs = make(map[string]string, len(attrNames))
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