Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go 1.23.0 #1096

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.lint
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ COPY ./internal/rgbmatrix-rpi/lib/rpi-rgb-led-matrix.BASE /tmp/rpi-rgb-led-matri
RUN cd /tmp/rpi-rgb-led-matrix && \
make

FROM golangci/golangci-lint:v1.59.1
FROM golangci/golangci-lint:v1.60.1

COPY --from=builder /tmp/rpi-rgb-led-matrix /sportslibs/rpi-rgb-led-matrix
2 changes: 1 addition & 1 deletion Dockerfile.pibuilder
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM $BASE
# Replace shell with bash so we can source files
SHELL ["/bin/bash", "--login", "-ce"]

ARG GOVERSION=1.22.5
ARG GOVERSION=1.23.0

RUN apt-get update --allow-unauthenticated --allow-insecure-repositories && \
apt-get install --allow-unauthenticated -y debian-archive-keyring && \
Expand Down
8 changes: 4 additions & 4 deletions internal/board/image/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ func filenameCompare(a string, b string) bool {
return false
}

max := len(aPaths)
if len(bPaths) > max {
max = len(bPaths)
maxPath := len(aPaths)
if len(bPaths) > maxPath {
maxPath = len(bPaths)
}

for x := 0; x < max; x++ {
for x := 0; x < maxPath; x++ {
if len(aPaths) < x+1 || len(bPaths) < x+1 {
return true
}
Expand Down
10 changes: 5 additions & 5 deletions internal/board/racing/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,23 @@ func (s *RacingBoard) renderEvent(ctx context.Context, bounds image.Rectangle, e
if err != nil {
return nil, err
}
max := canvasBounds.Dx() / 2
maxX := canvasBounds.Dx() / 2

for _, length := range lengths {
if length > max {
max = length
if length > maxX {
maxX = length
}
}

s.log.Debug("max racing schedule text length",
zap.Int("max", max),
zap.Int("max", maxX),
zap.Int("half bounds", canvasBounds.Dy()/2),
)

scheduleBounds := image.Rect(
canvasBounds.Max.X/2,
canvasBounds.Min.Y,
(canvasBounds.Max.X/2)+max,
(canvasBounds.Max.X/2)+maxX,
canvasBounds.Max.Y,
)

Expand Down
8 changes: 4 additions & 4 deletions internal/board/sport/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ func (s *SportBoard) calculateTeamInfoWidth(canvas draw.Image, writer *rgbrender
return defaultTeamInfoArea, err
}

max := 0
maxLen := 0
for _, l := range lengths {
if l > max {
max = l
if l > maxLen {
maxLen = l
}
}

return max, nil
return maxLen, nil
}

func (s *SportBoard) writeBoxColor() color.Color {
Expand Down
6 changes: 3 additions & 3 deletions internal/board/stat/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ func maxNameLength(canvas image.Rectangle) int {
return canvas.Dx() / 8
}

func maxedStr(str string, max int) string {
if max <= 0 || len(str) <= max {
func maxedStr(str string, maxLen int) string {
if maxLen <= 0 || len(str) <= maxLen {
return str
}

start := float64(max) / 2.0
start := float64(maxLen) / 2.0
i := int(start)
j := int(start) - 1
if math.Trunc(start) != start {
Expand Down
10 changes: 5 additions & 5 deletions internal/rgbrender/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,24 @@ func (l *LayerDrawer) ClearLayers() {

func (l *LayerDrawer) setForegroundPriority() {
hasForeground := false
max := BackgroundPriority
maxP := BackgroundPriority
for i := range l.layerPriorities {
if i > max {
max = i
if i > maxP {
maxP = i
}
if i == ForegroundPriority {
hasForeground = true
delete(l.layerPriorities, i)
}
}

l.maxLayer = max
l.maxLayer = maxP

if !hasForeground {
return
}

l.maxLayer = max + 1
l.maxLayer = maxP + 1

l.layerPriorities[l.maxLayer] = struct{}{}

Expand Down
4 changes: 2 additions & 2 deletions internal/rgbrender/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ func (c *ColorChar) validate() error {

// BreakText breaks text into lines based on a max pixel width
func (t *TextWriter) BreakText(canvas draw.Image, maxPixWidth int, text string) ([]string, error) {
max, err := t.MaxChars(canvas, maxPixWidth)
maxChar, err := t.MaxChars(canvas, maxPixWidth)
if err != nil {
return []string{}, err
}

return breakText(max, text), nil
return breakText(maxChar, text), nil
}

func breakText(maxLineLen int, text string) []string {
Expand Down
4 changes: 2 additions & 2 deletions internal/scrollcanvas/scroll_canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ func (c *ScrollCanvas) SetScrollSpeed(d time.Duration) {
return
}

max := 2
maxTry := 2
try := 0
for {
if try >= max {
if try >= maxTry {
break
}
try++
Expand Down
2 changes: 1 addition & 1 deletion script/common
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

ROOT="$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ))"
DOCKERCONF="${ROOT}/.dockerconfig"
GO_VERSION="1.22.5"
GO_VERSION="1.23.0"

getsha() {
if uname -s | grep -i darwin &> /dev/null; then
Expand Down