Fix capitalization of 'id'

Following the Go project source code guidelines, id is an abbreviation
and must typically be written as id or ID, not Id.
This commit is contained in:
delthas 2020-03-26 02:39:04 +01:00 committed by Simon Ser
parent a018f35c42
commit 2cb0cf3665
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -54,7 +54,7 @@ type upstreamConn struct {
tagsSupported bool tagsSupported bool
labelsSupported bool labelsSupported bool
nextLabelId uint64 nextLabelID uint64
saslClient sasl.Client saslClient sasl.Client
saslStarted bool saslStarted bool
@ -130,7 +130,7 @@ func (uc *upstreamConn) forEachDownstream(f func(*downstreamConn)) {
}) })
} }
func (uc *upstreamConn) forEachDownstreamById(id uint64, f func(*downstreamConn)) { func (uc *upstreamConn) forEachDownstreamByID(id uint64, f func(*downstreamConn)) {
uc.forEachDownstream(func(dc *downstreamConn) { uc.forEachDownstream(func(dc *downstreamConn) {
if id != 0 && id != dc.id { if id != 0 && id != dc.id {
return return
@ -181,10 +181,10 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
} }
} }
var downstreamId uint64 = 0 var downstreamID uint64 = 0
if label != "" { if label != "" {
var labelOffset uint64 var labelOffset uint64
n, err := fmt.Sscanf(label, "sd-%d-%d", &downstreamId, &labelOffset) n, err := fmt.Sscanf(label, "sd-%d-%d", &downstreamID, &labelOffset)
if err == nil && n < 2 { if err == nil && n < 2 {
err = errors.New("not enough arguments") err = errors.New("not enough arguments")
} }
@ -788,7 +788,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
ch, ok := uc.channels[name] ch, ok := uc.channels[name]
if !ok { if !ok {
// NAMES on a channel we have not joined, forward to downstream // NAMES on a channel we have not joined, forward to downstream
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
channel := dc.marshalChannel(uc, name) channel := dc.marshalChannel(uc, name)
members := strings.Split(members, " ") members := strings.Split(members, " ")
for i, member := range members { for i, member := range members {
@ -825,7 +825,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
ch, ok := uc.channels[name] ch, ok := uc.channels[name]
if !ok { if !ok {
// NAMES on a channel we have not joined, forward to downstream // NAMES on a channel we have not joined, forward to downstream
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
channel := dc.marshalChannel(uc, name) channel := dc.marshalChannel(uc, name)
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
@ -864,7 +864,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
trailing = strconv.Itoa(hops) + " " + realname trailing = strconv.Itoa(hops) + " " + realname
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
channel := channel channel := channel
if channel != "*" { if channel != "*" {
channel = dc.marshalChannel(uc, channel) channel = dc.marshalChannel(uc, channel)
@ -882,7 +882,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
name := name name := name
if name != "*" { if name != "*" {
// TODO: support WHO masks // TODO: support WHO masks
@ -900,7 +900,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -914,7 +914,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -928,7 +928,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -942,7 +942,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
params := []string{dc.nick, nick} params := []string{dc.nick, nick}
params = append(params, msg.Params[2:]...) params = append(params, msg.Params[2:]...)
@ -959,7 +959,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
} }
channels := strings.Split(channelList, " ") channels := strings.Split(channelList, " ")
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
channelList := make([]string, len(channels)) channelList := make([]string, len(channels))
for i, channel := range channels { for i, channel := range channels {
@ -980,7 +980,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
return err return err
} }
uc.forEachDownstreamById(downstreamId, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
nick := dc.marshalNick(uc, nick) nick := dc.marshalNick(uc, nick)
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -1158,8 +1158,8 @@ func (uc *upstreamConn) SendMessageLabeled(dc *downstreamConn, msg *irc.Message)
if msg.Tags == nil { if msg.Tags == nil {
msg.Tags = make(map[string]irc.TagValue) msg.Tags = make(map[string]irc.TagValue)
} }
msg.Tags["label"] = irc.TagValue(fmt.Sprintf("sd-%d-%d", dc.id, uc.nextLabelId)) msg.Tags["label"] = irc.TagValue(fmt.Sprintf("sd-%d-%d", dc.id, uc.nextLabelID))
uc.nextLabelId++ uc.nextLabelID++
} }
uc.SendMessage(msg) uc.SendMessage(msg)
} }