This commit is contained in:
Neale Pickett 2019-12-01 20:53:13 -07:00
parent 5dccc6431d
commit 97da227777
2 changed files with 26 additions and 26 deletions

View File

@ -118,16 +118,16 @@ func (s *State) SetTeamName(teamId string, teamName string) error {
if f, err := s.fs.Open("teamids.txt"); err != nil { if f, err := s.fs.Open("teamids.txt"); err != nil {
return fmt.Errorf("Team IDs file does not exist") return fmt.Errorf("Team IDs file does not exist")
} else { } else {
ok := false found := false
scanner := bufio.NewScanner(f) scanner := bufio.NewScanner(f)
for scanner.Scan() { for scanner.Scan() {
if scanner.Text() == teamId { if scanner.Text() == teamId {
ok = true found = true
break break
} }
} }
f.Close() f.Close()
if !ok { if !found {
return fmt.Errorf("Team ID not found in list of valid Team IDs") return fmt.Errorf("Team ID not found in list of valid Team IDs")
} }
} }