mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-19 21:59:59 -08:00
Remove extranous second arguments in for loops, according to Golang coding standards
This commit is contained in:
parent
92840d1770
commit
1ca218ec53
5 changed files with 14 additions and 14 deletions
|
|
@ -619,7 +619,7 @@ func (client *Client) sendChannelTree(channel *Channel) {
|
|||
chanstate.Position = proto.Int32(int32(channel.Position))
|
||||
|
||||
links := []uint32{}
|
||||
for cid, _ := range channel.Links {
|
||||
for cid := range channel.Links {
|
||||
links = append(links, uint32(cid))
|
||||
}
|
||||
chanstate.Links = links
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ func (channel *Channel) Freeze() (fc *freezer.Channel, err error) {
|
|||
|
||||
// Add linked channels
|
||||
links := []uint32{}
|
||||
for cid, _ := range channel.Links {
|
||||
for cid := range channel.Links {
|
||||
links = append(links, uint32(cid))
|
||||
}
|
||||
fc.Links = links
|
||||
|
|
@ -669,7 +669,7 @@ func NewServerFromFrozen(name string) (s *Server, err error) {
|
|||
if len(channel.Links) > 0 {
|
||||
links := channel.Links
|
||||
channel.Links = make(map[int]*Channel)
|
||||
for chanID, _ := range links {
|
||||
for chanID := range links {
|
||||
targetChannel := s.Channels[chanID]
|
||||
if targetChannel != nil {
|
||||
s.LinkChannels(channel, targetChannel)
|
||||
|
|
@ -760,7 +760,7 @@ func (server *Server) UpdateFrozenChannel(channel *Channel, state *mumbleproto.C
|
|||
}
|
||||
if len(state.LinksAdd) > 0 || len(state.LinksRemove) > 0 {
|
||||
links := []uint32{}
|
||||
for cid, _ := range channel.Links {
|
||||
for cid := range channel.Links {
|
||||
links = append(links, uint32(cid))
|
||||
}
|
||||
fc.Links = links
|
||||
|
|
|
|||
|
|
@ -1131,20 +1131,20 @@ func (server *Server) handleACLMessage(client *Client, msg *Message) {
|
|||
// message that maps user ids to usernames.
|
||||
if hasgroup {
|
||||
toadd := map[int]bool{}
|
||||
for uid, _ := range group.Add {
|
||||
for uid := range group.Add {
|
||||
users[uid] = true
|
||||
toadd[uid] = true
|
||||
}
|
||||
for uid, _ := range group.Remove {
|
||||
for uid := range group.Remove {
|
||||
users[uid] = true
|
||||
delete(toadd, uid)
|
||||
}
|
||||
for uid, _ := range toadd {
|
||||
for uid := range toadd {
|
||||
mpgroup.Add = append(mpgroup.Add, uint32(uid))
|
||||
}
|
||||
}
|
||||
if haspgroup {
|
||||
for uid, _ := range pgroup.MembersInContext(&parent.ACL) {
|
||||
for uid := range pgroup.MembersInContext(&parent.ACL) {
|
||||
users[uid] = true
|
||||
mpgroup.InheritedMembers = append(mpgroup.InheritedMembers, uint32(uid))
|
||||
}
|
||||
|
|
@ -1160,7 +1160,7 @@ func (server *Server) handleACLMessage(client *Client, msg *Message) {
|
|||
|
||||
// Map the user ids in the user map to usernames of users.
|
||||
queryusers := &mumbleproto.QueryUsers{}
|
||||
for uid, _ := range users {
|
||||
for uid := range users {
|
||||
user, ok := server.Users[uint32(uid)]
|
||||
if !ok {
|
||||
client.Printf("Invalid user id in ACL")
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ func populateChannelsFromDatabase(server *Server, db *sql.DB, parentID int) erro
|
|||
}
|
||||
|
||||
// Add subchannels
|
||||
for id, _ := range parent.children {
|
||||
for id := range parent.children {
|
||||
err = populateChannelsFromDatabase(server, db, id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ func (group *Group) AddContains(id int) (ok bool) {
|
|||
// AddUsers gets the list of user ids in the Add set.
|
||||
func (group *Group) AddUsers() []int {
|
||||
users := []int{}
|
||||
for uid, _ := range group.Add {
|
||||
for uid := range group.Add {
|
||||
users = append(users, uid)
|
||||
}
|
||||
return users
|
||||
|
|
@ -65,7 +65,7 @@ func (group *Group) RemoveContains(id int) (ok bool) {
|
|||
// RemoveUsers gets the list of user ids in the Remove set.
|
||||
func (group *Group) RemoveUsers() []int {
|
||||
users := []int{}
|
||||
for uid, _ := range group.Remove {
|
||||
for uid := range group.Remove {
|
||||
users = append(users, uid)
|
||||
}
|
||||
return users
|
||||
|
|
@ -106,10 +106,10 @@ func (group *Group) MembersInContext(ctx *Context) map[int]bool {
|
|||
}
|
||||
|
||||
for _, curgroup := range groups {
|
||||
for uid, _ := range curgroup.Add {
|
||||
for uid := range curgroup.Add {
|
||||
members[uid] = true
|
||||
}
|
||||
for uid, _ := range curgroup.Remove {
|
||||
for uid := range curgroup.Remove {
|
||||
delete(members, uid)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue