Skip to content

Commit

Permalink
Fix golangci-lint failures
Browse files Browse the repository at this point in the history
  • Loading branch information
hloeung committed Feb 17, 2024
1 parent 74ae87e commit 6494bff
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions bridge/matrix/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (m *Matrix) syncCallback(resp *mautrix.RespSync, since string) bool {
return true
}

// nolint:funlen
func (m *Matrix) handleMatrix(onConnect func()) {
syncer := m.mc.Syncer.(*mautrix.DefaultSyncer)

Expand Down Expand Up @@ -282,7 +283,7 @@ func (m *Matrix) handleEvent(source mautrix.EventSource, ev *event.Event) {
//Event: rmsg.Event,

Check failure on line 283 in bridge/matrix/matrix.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
//ParentID: mxEvent
},
}
} //nolint:gocritic

m.eventChan <- event
return
Expand All @@ -300,7 +301,7 @@ func (m *Matrix) handleEvent(source mautrix.EventSource, ev *event.Event) {
//Event: rmsg.Event,
//ParentID: mxEvent
},
}
} //nolint:gocritic

m.eventChan <- event
}
Expand Down
2 changes: 1 addition & 1 deletion bridge/matrix/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s *Syncer) ProcessResponse(resp *mautrix.RespSync, since string) error {
append(sync.State.Events, sync.Timeline.Events...),
sync.Ephemeral.Events...),
sync.AccountData.Events...) {
ev.Content.ParseRaw(ev.Type)
ev.Content.ParseRaw(ev.Type) //nolint:errcheck
ev.RoomID = room
spew.Dump(ev)

Expand Down
4 changes: 2 additions & 2 deletions mm-go-irckit/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ outerloop:
case irc.PASS:
u.Pass = msg.Params
case irc.JOIN:
s.EncodeMessage(u, irc.ERR_NOTREGISTERED, []string{"*"}, "Please register first")
s.EncodeMessage(u, irc.ERR_NOTREGISTERED, []string{"*"}, "Please register first") //nolint:errcheck
// https://ircv3.net/specs/extensions/capability-negotiation.html
case irc.CAP:
subcommand := msg.Params[0]
Expand Down Expand Up @@ -475,7 +475,7 @@ outerloop:

ok := s.add(u)
if !ok {
s.EncodeMessage(u, irc.ERR_NICKNAMEINUSE, []string{u.Nick}, "Nickname is already in use")
s.EncodeMessage(u, irc.ERR_NICKNAMEINUSE, []string{u.Nick}, "Nickname is already in use") //nolint:errcheck
continue
}
s.u = u
Expand Down
2 changes: 1 addition & 1 deletion mm-go-irckit/server_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func CmdPrivMsg(s Server, u *User, msg *irc.Message) error {

msgID, err2 := u.br.MsgChannel(ch.ID(), msg.Trailing)
if err2 != nil {
u.MsgSpoofUser(u, u.br.Protocol(), "msg: "+msg.Trailing+" could not be sent "+err2.Error())
u.MsgSpoofUser(u, u.br.Protocol(), "msg: "+msg.Trailing+" could not be sent "+err2.Error()) //nolint:goconst
return err2
}

Expand Down
4 changes: 2 additions & 2 deletions mm-go-irckit/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func login(u *User, toUser *User, args []string, service string) {

u.MsgUser(toUser, "login OK")
if u.Credentials.Token != "" {
u.MsgUser(toUser, "token used: "+u.Credentials.Token)
u.MsgUser(toUser, "token used: "+u.Credentials.Token) //nolint:goconst
}

return
Expand Down Expand Up @@ -299,7 +299,7 @@ func search(u *User, toUser *User, args []string, service string) {

if len(postlist.Posts[postlist.Order[i]].FileIds) > 0 {
for _, fname := range u.br.GetFileLinks(postlist.Posts[postlist.Order[i]].FileIds) {
u.MsgUser(toUser, "\x1ddownload file - "+fname+"\x1d")
u.MsgUser(toUser, "\x1ddownload file - "+fname+"\x1d") //nolint:goconst
}
}

Expand Down
2 changes: 1 addition & 1 deletion mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ func (u *User) prefixContext(channelID, messageID, parentID, event string) strin
prefixChar = "↪"
}

if u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post" {
if u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post" { //nolint:goconst
if parentID == "" {
return fmt.Sprintf("[@@%s]", messageID)
}
Expand Down

0 comments on commit 6494bff

Please sign in to comment.