Skip to content

Commit

Permalink
Update to go 1.22.x
Browse files Browse the repository at this point in the history
* Update to math/rand/v2
* Adjust CI, Dockerfiles and docs
  • Loading branch information
Bios-Marcel committed Mar 2, 2024
1 parent 2cdc9c9 commit ee4d221
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Run tests and write coverprofile
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Run tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
run-tests:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.22.x]
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ in running a native Windows container.
## Building / Running

Dependencies:
* [go](https://go.dev/doc/install) version 1.21 or later
* [go](https://go.dev/doc/install) version 1.22 or later
* [git](https://git-scm.com/) (You can also download a .zip from Github)

In order to download and build, open a terminal and execute:
Expand Down Expand Up @@ -137,4 +137,4 @@ original file.
* [Trash Icon](https://www.iconfinder.com/icons/315225/trash_can_icon) - Made by [Yannick Lung](https://yannicklung.com)
* [Undo Icon](https://www.iconfinder.com/icons/308948/arrow_undo_icon) - Made by [Ivan Boyko](https://www.iconfinder.com/visualpharm)
* [Alarmclock Icon](https://www.iconfinder.com/icons/4280508/alarm_outlined_alert_clock_icon) - Made by [Kit of Parts](https://www.iconfinder.com/kitofparts)
* https://www.iconfinder.com/icons/808399/load_turn_turnaround_icon TODO
* https://www.iconfinder.com/icons/808399/load_turn_turnaround_icon TODO
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/scribble-rs/scribble.rs

go 1.21.3
go 1.22.0

require (
github.com/Bios-Marcel/discordemojimap/v2 v2.0.6-0.20231020161444-8c7f7fa6e5a6
Expand Down
2 changes: 1 addition & 1 deletion internal/game/lobby.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"
"math"
"math/rand"
"math/rand/v2"
"sort"
"strings"
"sync"
Expand Down
2 changes: 1 addition & 1 deletion internal/game/words.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"embed"
"errors"
"fmt"
"math/rand"
"math/rand/v2"
"strings"
"unicode/utf8"

Expand Down
2 changes: 1 addition & 1 deletion linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# We explicitly use a certain major version of go, to make sure we don't build
# with a newer verison than we are using for CI tests, as we don't directly
# test the produced binary but from source code directly.
FROM docker.io/golang:1.21.3 AS builder
FROM docker.io/golang:1.22.0 AS builder
WORKDIR /app

# This causes caching of the downloaded go modules and makes repeated local
Expand Down
10 changes: 4 additions & 6 deletions tools/simulate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"io"
"log"
"math/rand"
"math/rand/v2"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -82,7 +82,6 @@ type SimPlayer struct {
Name string
Usersession string
ws *gws.Conn
rand *rand.Rand
}

func (s *SimPlayer) WriteJSON(value any) error {
Expand All @@ -101,9 +100,9 @@ func (s *SimPlayer) SendRandomStroke() {
"toX": rand.Float64(),
"toY": rand.Float64(),
"color": map[string]any{
"r": rand.Intn(255),
"g": rand.Intn(255),
"b": rand.Intn(255),
"r": rand.Int32N(255),
"g": rand.Int32N(255),
"b": rand.Int32N(255),
},
"lineWidth": 5,
}); err != nil {
Expand Down Expand Up @@ -171,7 +170,6 @@ func JoinPlayer(lobbyId string) (*SimPlayer, error) {
return &SimPlayer{
Usersession: session,
ws: wsConnection,
rand: rand.New(rand.NewSource(time.Now().Unix())),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion windows.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# We explicitly use a certain major version of go, to make sure we don't build
# with a newer verison than we are using for CI tests, as we don't directly
# test the produced binary but from source code directly.
FROM docker.io/golang:1.21.3-nanoserver-ltsc2022 AS builder
FROM docker.io/golang:1.22.0-nanoserver-ltsc2022 AS builder
WORKDIR /app

# This causes caching of the downloaded go modules and makes repeated local
Expand Down

0 comments on commit ee4d221

Please sign in to comment.