linting + solving linting

This commit is contained in:
Sacha Ligthert 2025-03-05 11:44:10 +01:00
parent 07f81679d8
commit e8d5ecc772
2 changed files with 21 additions and 17 deletions

View File

@ -10,3 +10,6 @@ tasks:
- rm builds/* || true
- go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o builds/rowboz.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh
- for i in `ls builds/*windows*`; do mv -v $i $i.exe; done
lint:
cmds:
- golangci-lint run

View File

@ -1,7 +1,6 @@
package robots
import (
"runtime"
"strconv"
)
@ -42,26 +41,28 @@ func (game *Game) drawBox() {
}
// drawCoords Print the coordinates of the player
func (game *Game) drawCoords() {
var x, y int = 25, 24
for _, r := range []rune("[ x:" + strconv.FormatInt(int64(game.player.position.x), 10) + " y:" + strconv.FormatInt(int64(game.player.position.y), 10) + " ]") {
game.screen.SetContent(x, y-1, r, nil, game.style)
x++
}
}
// func (game *Game) drawCoords() {
// var x, y int = 25, 24
// for _, r := range []rune("[ x:" + strconv.FormatInt(int64(game.player.position.x), 10) + " y:" + strconv.FormatInt(int64(game.player.position.y), 10) + " ]") {
// game.screen.SetContent(x, y-1, r, nil, game.style)
// x++
// }
// }
func (game *Game) drawDebug() {
var x, y int = 40, 24
for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " Bots: " + strconv.FormatInt(int64(len(game.robots)), 10) + " ]") {
game.screen.SetContent(x, y-1, r, nil, game.style)
x++
}
}
// func (game *Game) drawDebug() {
// var x, y int = 40, 24
// for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " Bots: " + strconv.FormatInt(int64(len(game.robots)), 10) + " ]") {
// game.screen.SetContent(x, y-1, r, nil, game.style)
// x++
// }
// }
func (game *Game) drawScore() {
var x, y int = 5, 24
for _, r := range []rune("[ Score: " + strconv.FormatInt(int64(game.player.score), 10) + " Level: " + strconv.FormatInt(int64(game.level), 10) + " ]") {
game.screen.SetContent(x, y-1, r, nil, game.style)
content := "[ Score: " + strconv.FormatInt(int64(game.player.score), 10) + " Level: " + strconv.FormatInt(int64(game.level), 10) + " ]"
for i := 0; i < len(content); i++ {
game.screen.SetContent(x, y-1, rune(content[i]), nil, game.style)
x++
}
}