Skip to content

Commit

Permalink
Fix linting (#1934)
Browse files Browse the repository at this point in the history
Signed-off-by: Rodney Osodo <[email protected]>
  • Loading branch information
rodneyosodo authored Oct 18, 2023
1 parent 687505c commit 89fcf12
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 75 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ require (
go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
golang.org/x/crypto v0.14.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/net v0.17.0
golang.org/x/sync v0.4.0
gonum.org/v1/gonum v0.14.0
Expand Down Expand Up @@ -216,6 +215,7 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion pkg/sdk/go/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ func (sdk mfSDK) ConnectThing(thingID, channelID, token string) errors.SDKError
_, _, sdkerr := sdk.processRequest(http.MethodPost, url, token, nil, nil, http.StatusNoContent)

return sdkerr

}

func (sdk mfSDK) DisconnectThing(thingID, channelID, token string) errors.SDKError {
Expand Down
5 changes: 0 additions & 5 deletions pkg/sdk/go/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,3 @@ type SubscriptionPage struct {
type identifyThingResp struct {
ID string `json:"id,omitempty"`
}

type canAccessRes struct {
ThingID string `json:"thing_id"`
Authorized bool `json:"authorized"`
}
1 change: 0 additions & 1 deletion things/api/http/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func clientsHandler(svc things.Service, r *chi.Mux, logger mflog.Logger) http.Ha
api.EncodeResponse,
opts...,
), "thing_delete_share").ServeHTTP)

})

// Ideal location: things service, channels endpoint
Expand Down
61 changes: 0 additions & 61 deletions things/api/http/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/mainflux/mainflux/internal/apiutil"
mfclients "github.com/mainflux/mainflux/pkg/clients"
"github.com/mainflux/mainflux/pkg/errors"
"golang.org/x/exp/slices"
)

type createClientReq struct {
Expand Down Expand Up @@ -208,66 +207,6 @@ func (req changeClientStatusReq) validate() error {
return nil
}

type assignUsersGroupsRequest struct {
token string
groupID string
Relation string `json:"relation,omitempty"`
MemberKind string `json:"member_kind,omitempty"`
Members []string `json:"members"`
}

func (req assignUsersGroupsRequest) validate() error {
if req.token == "" {
return apiutil.ErrBearerToken
}
if req.MemberKind == "" {
return apiutil.ErrMissingMemberKind
}
if !slices.Contains([]string{"users", "groups"}, req.MemberKind) {
return apiutil.ErrInvalidMemberKind
}
if req.groupID == "" {
return apiutil.ErrMissingID
}
if len(req.Members) == 0 {
return apiutil.ErrEmptyList
}

return nil
}

type unassignUsersGroupsRequest struct {
token string
groupID string
Relation string `json:"relation,omitempty"`
MemberKind string `json:"member_kind,omitempty"`
Members []string `json:"members"`
}

func (req unassignUsersGroupsRequest) validate() error {
if req.token == "" {
return apiutil.ErrBearerToken
}

if req.MemberKind == "" {
return apiutil.ErrMissingMemberKind
}

if !slices.Contains([]string{"users", "groups"}, req.MemberKind) {
return apiutil.ErrInvalidMemberKind
}

if req.groupID == "" {
return apiutil.ErrMissingID
}

if len(req.Members) == 0 {
return apiutil.ErrEmptyList
}

return nil
}

type assignUsersRequest struct {
token string
groupID string
Expand Down
3 changes: 1 addition & 2 deletions things/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (svc service) filterAllowedThingIDs(ctx context.Context, userID, permission
}
return ids, nil
}

func (svc service) UpdateClient(ctx context.Context, token string, cli mfclients.Client) (mfclients.Client, error) {
userID, err := svc.authorize(ctx, userType, tokenKind, token, editPermission, thingType, cli.ID)
if err != nil {
Expand Down Expand Up @@ -309,7 +310,6 @@ func (svc service) Share(ctx context.Context, token, id, relation string, userid
}

for _, userid := range userids {

addPolicyReq := &mainflux.AddPolicyReq{
SubjectType: userType,
Subject: userid,
Expand All @@ -336,7 +336,6 @@ func (svc service) Unshare(ctx context.Context, token, id, relation string, user
}

for _, userid := range userids {

delPolicyReq := &mainflux.DeletePolicyReq{
SubjectType: userType,
Subject: userid,
Expand Down
5 changes: 2 additions & 3 deletions tools/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ func messaging(s sdk.SDK, conf Config, token string, things []sdk.Thing, channel
for _, thing := range things {
for _, channel := range channels {
conn := sdk.Connection{
ThingID: thing.ID,
ChannelID: channel.ID,
Permission: "publish",
ThingID: thing.ID,
ChannelID: channel.ID,
}
if err := s.Connect(conn, token); err != nil {
return fmt.Errorf("failed to connect thing %s to channel %s", thing.ID, channel.ID)
Expand Down
1 change: 0 additions & 1 deletion tools/provision/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func Provision(conf Config) error {
}
}


return nil
}

Expand Down

0 comments on commit 89fcf12

Please sign in to comment.