Fix all go vet issues

This commit is contained in:
Marc Di Luzio 2020-06-30 23:59:58 +01:00
parent 204c786103
commit b5707ab71c
13 changed files with 195 additions and 170 deletions

View file

@ -208,21 +208,22 @@ func (s *Server) LoadWorld() error {
// SpawnRoverForAccount spawns the rover rover for an account
func (s *Server) SpawnRoverForAccount(account string) (string, error) {
if inst, err := s.world.SpawnRover(); err != nil {
inst, err := s.world.SpawnRover()
if err != nil {
return "", err
} else {
err := s.accountant.AssignData(account, "rover", inst)
if err != nil {
log.Printf("Failed to assign rover to account, %s", err)
// Try and clear up the rover
if err := s.world.DestroyRover(inst); err != nil {
log.Printf("Failed to destroy rover after failed rover assign: %s", err)
}
return "", err
} else {
return inst, nil
}
}
err = s.accountant.AssignData(account, "rover", inst)
if err != nil {
log.Printf("Failed to assign rover to account, %s", err)
// Try and clear up the rover
if err := s.world.DestroyRover(inst); err != nil {
log.Printf("Failed to destroy rover after failed rover assign: %s", err)
}
return "", err
}
return inst, nil
}