From 576a117c7ca5347f2ce054516b584e21d57ca1cf Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Mon, 4 Nov 2024 14:02:05 +0100 Subject: [PATCH] bump Golang to 1.23 (#3702) --- .github/workflows/code_lint.yml | 6 +++--- .github/workflows/code_test.yml | 2 +- Makefile | 8 ++++---- README.md | 4 ++-- go.mod | 2 +- internal/api/paginate.go | 14 +++++++------- internal/conf/optional_global.go | 2 +- internal/conf/optional_path.go | 2 +- internal/logger/logger.go | 4 ++-- internal/servers/webrtc/server.go | 4 ++-- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/code_lint.yml b/.github/workflows/code_lint.yml index 1241c158..b25c3b8f 100644 --- a/.github/workflows/code_lint.yml +++ b/.github/workflows/code_lint.yml @@ -17,13 +17,13 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - run: go generate ./... - uses: golangci/golangci-lint-action@v4 with: - version: v1.55.0 + version: v1.61.0 mod_tidy: runs-on: ubuntu-22.04 @@ -33,7 +33,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - run: make lint-mod-tidy diff --git a/.github/workflows/code_test.yml b/.github/workflows/code_test.yml index 7b2afb2d..32918d71 100644 --- a/.github/workflows/code_test.yml +++ b/.github/workflows/code_test.yml @@ -41,6 +41,6 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - run: make test-highlevel-nodocker diff --git a/Makefile b/Makefile index 06c0d2bc..cffe5625 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -BASE_IMAGE = golang:1.22-alpine3.19 -LINT_IMAGE = golangci/golangci-lint:v1.59.1 -NODE_IMAGE = node:20-alpine3.19 -ALPINE_IMAGE = alpine:3.19 +BASE_IMAGE = golang:1.23-alpine3.20 +LINT_IMAGE = golangci/golangci-lint:v1.61.0 +NODE_IMAGE = node:20-alpine3.20 +ALPINE_IMAGE = alpine:3.20 RPI32_IMAGE = balenalib/raspberry-pi:bullseye-run-20240508 RPI64_IMAGE = balenalib/raspberrypi3-64:bullseye-run-20240429 diff --git a/README.md b/README.md index a7626ced..0bab8278 100644 --- a/README.md +++ b/README.md @@ -2290,7 +2290,7 @@ Be aware that RTMPS is currently unsupported by all major players. However, you ### Standard -Install git and Go ≥ 1.22. Clone the repository, enter into the folder and start the building process: +Install git and Go ≥ 1.23. Clone the repository, enter into the folder and start the building process: ```sh git clone https://github.com/bluenviron/mediamtx @@ -2331,7 +2331,7 @@ If you need to use a custom or external libcamera when interacting with the Rasp Cross compilation allows to build an executable for a target machine from another machine with different operating system or architecture. This is useful in case the target machine doesn't have enough resources for compilation or if you don't want to install the compilation dependencies on it. -On the machine you want to use to compile, install git and Go ≥ 1.22. Clone the repository, enter into the folder and start the building process: +On the machine you want to use to compile, install git and Go ≥ 1.23. Clone the repository, enter into the folder and start the building process: ```sh git clone https://github.com/bluenviron/mediamtx diff --git a/go.mod b/go.mod index 7c8c75f0..7a9e7f8d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bluenviron/mediamtx -go 1.22 +go 1.23 require ( code.cloudfoundry.org/bytefmt v0.0.0 diff --git a/internal/api/paginate.go b/internal/api/paginate.go index 8be72062..6d58f1ee 100644 --- a/internal/api/paginate.go +++ b/internal/api/paginate.go @@ -19,17 +19,17 @@ func paginate2(itemsPtr interface{}, itemsPerPage int, page int) int { pageCount++ } - min := page * itemsPerPage - if min > itemsLen { - min = itemsLen + minVal := page * itemsPerPage + if minVal > itemsLen { + minVal = itemsLen } - max := (page + 1) * itemsPerPage - if max > itemsLen { - max = itemsLen + maxVal := (page + 1) * itemsPerPage + if maxVal > itemsLen { + maxVal = itemsLen } - ritems.Set(ritems.Slice(min, max)) + ritems.Set(ritems.Slice(minVal, maxVal)) return pageCount } diff --git a/internal/conf/optional_global.go b/internal/conf/optional_global.go index afaeb158..5f929300 100644 --- a/internal/conf/optional_global.go +++ b/internal/conf/optional_global.go @@ -23,7 +23,7 @@ var optionalGlobalValuesType = func() reflect.Type { typ := f.Type if typ.Kind() != reflect.Pointer { - typ = reflect.PtrTo(typ) + typ = reflect.PointerTo(typ) } fields = append(fields, reflect.StructField{ diff --git a/internal/conf/optional_path.go b/internal/conf/optional_path.go index 47eff598..55e821cf 100644 --- a/internal/conf/optional_path.go +++ b/internal/conf/optional_path.go @@ -25,7 +25,7 @@ var optionalPathValuesType = func() reflect.Type { typ := f.Type if typ.Kind() != reflect.Pointer { - typ = reflect.PtrTo(typ) + typ = reflect.PointerTo(typ) } fields = append(fields, reflect.StructField{ diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 92afe356..1ff43d7d 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -87,10 +87,10 @@ func writeTime(buf *bytes.Buffer, t time.Time, useColor bool) { intbuf.WriteByte(' ') // time - hour, min, sec := t.Clock() + hour, minute, sec := t.Clock() intbuf.Write(itoa(hour, 2)) intbuf.WriteByte(':') - intbuf.Write(itoa(min, 2)) + intbuf.Write(itoa(minute, 2)) intbuf.WriteByte(':') intbuf.Write(itoa(sec, 2)) intbuf.WriteByte(' ') diff --git a/internal/servers/webrtc/server.go b/internal/servers/webrtc/server.go index 64c1fc47..5d0fd0f5 100644 --- a/internal/servers/webrtc/server.go +++ b/internal/servers/webrtc/server.go @@ -65,14 +65,14 @@ func randInt63n(n int64) (int64, error) { return r & (n - 1), nil } - max := int64((1 << 63) - 1 - (1<<63)%uint64(n)) + maxVal := int64((1 << 63) - 1 - (1<<63)%uint64(n)) v, err := randInt63() if err != nil { return 0, err } - for v > max { + for v > maxVal { v, err = randInt63() if err != nil { return 0, err