bugfix: fix Go linter warnings
This commit is contained in:
parent
1b659e95eb
commit
4b81042955
@ -4,10 +4,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"sirlab.de/go/knowyt/engine"
|
"sirlab.de/go/knowyt/engine"
|
||||||
"sirlab.de/go/knowyt/fileutil"
|
"sirlab.de/go/knowyt/fileutil"
|
||||||
"sirlab.de/go/knowyt/quote"
|
"sirlab.de/go/knowyt/quote"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGameFromFile(id, fileName string) (*Game, error) {
|
func NewGameFromFile(id, fileName string) (*Game, error) {
|
||||||
@ -18,7 +19,7 @@ func NewGameFromFile(id, fileName string) (*Game, error) {
|
|||||||
|
|
||||||
var gmJson GameJson
|
var gmJson GameJson
|
||||||
if err := json.Unmarshal(jsonBytes, &gmJson); err != nil {
|
if err := json.Unmarshal(jsonBytes, &gmJson); err != nil {
|
||||||
return nil, fmt.Errorf("%s: %v\n", fileName, err)
|
return nil, fmt.Errorf("%s: %v", fileName, err)
|
||||||
} else {
|
} else {
|
||||||
lang := gmJson.Lang
|
lang := gmJson.Lang
|
||||||
if lang == "" {
|
if lang == "" {
|
||||||
|
@ -3,7 +3,7 @@ package game
|
|||||||
func (gm *Game) GetGameInfo() *GameInfoJson {
|
func (gm *Game) GetGameInfo() *GameInfoJson {
|
||||||
gameInfo := gm.initGameInfoJson()
|
gameInfo := gm.initGameInfoJson()
|
||||||
|
|
||||||
for i, _ := range gameInfo.Players {
|
for i := range gameInfo.Players {
|
||||||
quotes := gm.getQuotesInfoByUserId(gameInfo.Players[i].Id)
|
quotes := gm.getQuotesInfoByUserId(gameInfo.Players[i].Id)
|
||||||
gameInfo.Players[i].NumberOfQuotes = len(quotes)
|
gameInfo.Players[i].NumberOfQuotes = len(quotes)
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,5 @@ func (gm *Game) getPlayerById(id string) (*playerInfo, error) {
|
|||||||
return &plInfo, nil
|
return &plInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("player id \"%s\" not found in game\n", id)
|
return nil, fmt.Errorf("player id \"%s\" not found in game", id)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package game
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"sirlab.de/go/knowyt/quote"
|
"sirlab.de/go/knowyt/quote"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ func (gm *Game) getQuoteById(id string) (*quote.Quote, error) {
|
|||||||
|
|
||||||
quote := gm.quotes[id]
|
quote := gm.quotes[id]
|
||||||
if quote == nil {
|
if quote == nil {
|
||||||
return nil, fmt.Errorf("quote id \"%s\" not found in game\n", id)
|
return nil, fmt.Errorf("quote id \"%s\" not found in game", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
return quote, nil
|
return quote, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user