mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Update to Go 1.20 and fix rand-related issues.
This commit is contained in:
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.20.x
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -7,7 +7,7 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.20.x
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|||||||
7
main.go
7
main.go
@@ -1,14 +1,15 @@
|
|||||||
// Copyright 2014 Team 254. All Rights Reserved.
|
// Copyright 2014 Team 254. All Rights Reserved.
|
||||||
// Author: pat@patfairbank.com (Patrick Fairbank)
|
// Author: pat@patfairbank.com (Patrick Fairbank)
|
||||||
|
|
||||||
|
// Go version 1.20 or newer is required due to how it initializes the PRNG.
|
||||||
|
//go:build go1.20
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Team254/cheesy-arena-lite/field"
|
"github.com/Team254/cheesy-arena-lite/field"
|
||||||
"github.com/Team254/cheesy-arena-lite/web"
|
"github.com/Team254/cheesy-arena-lite/web"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const eventDbPath = "./event.db"
|
const eventDbPath = "./event.db"
|
||||||
@@ -16,8 +17,6 @@ const httpPort = 8080
|
|||||||
|
|
||||||
// Main entry point for the application.
|
// Main entry point for the application.
|
||||||
func main() {
|
func main() {
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
|
|
||||||
arena, err := field.NewArena(eventDbPath)
|
arena, err := field.NewArena(eventDbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Error during startup: ", err)
|
log.Fatalln("Error during startup: ", err)
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import (
|
|||||||
"github.com/Team254/cheesy-arena-lite/game"
|
"github.com/Team254/cheesy-arena-lite/game"
|
||||||
"github.com/Team254/cheesy-arena-lite/model"
|
"github.com/Team254/cheesy-arena-lite/model"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCalculateRankings(t *testing.T) {
|
func TestCalculateRankings(t *testing.T) {
|
||||||
|
rand.Seed(1)
|
||||||
database := setupTestDb(t)
|
database := setupTestDb(t)
|
||||||
|
|
||||||
setupMatchResultsForRankings(database)
|
setupMatchResultsForRankings(database)
|
||||||
|
|||||||
Reference in New Issue
Block a user