diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 36551cb2..5df5f80e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.25" + go-version: "1.26" - run: go generate ./... @@ -33,7 +33,7 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.25" + go-version: "1.26" - run: make lint-go-mod @@ -45,7 +45,7 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.25" + go-version: "1.26" - run: make lint-conf @@ -57,7 +57,7 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.25" + go-version: "1.26" - run: make lint-go2api diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d981019..646dcff6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,6 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.25" + go-version: "1.26" - run: make test-e2e-nodocker diff --git a/Makefile b/Makefile index 6dcba19c..b87dac4b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BASE_IMAGE = golang:1.25-alpine3.22 +BASE_IMAGE = golang:1.26-alpine3.22 GOLANGCI_LINT_IMAGE = golangci/golangci-lint:v2.10.1 NODE_IMAGE = node:20-alpine3.22 diff --git a/docs/4-other/1-compile.md b/docs/4-other/1-compile.md index f7675f95..099ae722 100644 --- a/docs/4-other/1-compile.md +++ b/docs/4-other/1-compile.md @@ -2,7 +2,7 @@ ## Standard procedure -1. Install git and Go ≥ 1.25. +1. Install git and Go ≥ 1.26. 2. Clone the repository, enter into the folder and start the building process: @@ -21,7 +21,7 @@ If you need to use a custom or external libcamera to interact with some Raspberr 1. Download [mediamtx-rpicamera source code](https://github.com/bluenviron/mediamtx-rpicamera) and compile it against the external libcamera. Instructions are in the repository. -2. Install git and Go ≥ 1.25. +2. Install git and Go ≥ 1.26. 3. Clone the _MediaMTX_ repository: @@ -49,7 +49,7 @@ If you need to use a custom or external libcamera to interact with some Raspberr 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. -1. On the machine you want to use to compile, install git and Go ≥ 1.25. +1. On the machine you want to use to compile, install git and Go ≥ 1.26. 2. Clone the repository, enter into the folder and start the building process: diff --git a/go.mod b/go.mod index b2823c33..2908f5e9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bluenviron/mediamtx -go 1.25.0 +go 1.26.0 require ( code.cloudfoundry.org/bytefmt v0.64.0 diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 5b2058c3..5eb74153 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -52,9 +52,7 @@ func setAllNilSlicesToEmptyRecursive(rv reflect.Value) { } if rv.Kind() == reflect.Struct { - for i := range rv.NumField() { - field := rv.Field(i) - + for _, field := range rv.Fields() { switch field.Kind() { case reflect.Slice: if field.IsNil() { diff --git a/internal/conf/env/env_test.go b/internal/conf/env/env_test.go index 876a6d7f..6f2b22ad 100644 --- a/internal/conf/env/env_test.go +++ b/internal/conf/env/env_test.go @@ -9,7 +9,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } type myDuration time.Duration diff --git a/internal/conf/rtsp_transport.go b/internal/conf/rtsp_transport.go index 65c368ec..c1ca8ca7 100644 --- a/internal/conf/rtsp_transport.go +++ b/internal/conf/rtsp_transport.go @@ -9,7 +9,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } // RTSPTransport is the rtspTransport parameter. diff --git a/internal/core/core.go b/internal/core/core.go index ee9be841..c7e7f099 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -305,7 +305,7 @@ func (p *Core) createResources(initial bool) error { } if initial { - p.Log(logger.Info, "MediaMTX "+string(version)+", "+runtime.GOOS+", "+getArch()) + p.Log(logger.Info, "MediaMTX %s, %s, %s", string(version), runtime.GOOS, getArch()) if p.confPath != "" { a, _ := filepath.Abs(p.confPath) diff --git a/internal/metrics/metrics_test.go b/internal/metrics/metrics_test.go index 1e0d048c..5e09711c 100644 --- a/internal/metrics/metrics_test.go +++ b/internal/metrics/metrics_test.go @@ -17,7 +17,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } type dummyPathManager struct{} diff --git a/internal/protocols/webrtc/from_stream.go b/internal/protocols/webrtc/from_stream.go index b3ee3dfa..d8e4e41e 100644 --- a/internal/protocols/webrtc/from_stream.go +++ b/internal/protocols/webrtc/from_stream.go @@ -42,7 +42,9 @@ var errNoSupportedCodecsFrom = errors.New( "AV1, VP9, VP8, H265, H264, Opus, G722, G711, LPCM") func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } func randUint32() (uint32, error) { diff --git a/internal/protocols/whip/ice_fragment_test.go b/internal/protocols/whip/ice_fragment_test.go index fe5c5d0b..3cde6704 100644 --- a/internal/protocols/whip/ice_fragment_test.go +++ b/internal/protocols/whip/ice_fragment_test.go @@ -8,7 +8,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } var iceFragmentCases = []struct { diff --git a/internal/recordstore/segment_test.go b/internal/recordstore/segment_test.go index 0e5768c4..aa535fcc 100644 --- a/internal/recordstore/segment_test.go +++ b/internal/recordstore/segment_test.go @@ -12,7 +12,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } func TestFindAllPathsWithSegments(t *testing.T) { diff --git a/internal/servers/hls/muxer.go b/internal/servers/hls/muxer.go index cdb8aa5b..eda01250 100644 --- a/internal/servers/hls/muxer.go +++ b/internal/servers/hls/muxer.go @@ -21,7 +21,9 @@ const ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } func emptyTimer() *time.Timer { diff --git a/internal/servers/webrtc/server_test.go b/internal/servers/webrtc/server_test.go index cb9744f0..ed07df45 100644 --- a/internal/servers/webrtc/server_test.go +++ b/internal/servers/webrtc/server_test.go @@ -30,7 +30,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } func checkClose(t *testing.T, closeFunc func() error) { diff --git a/internal/staticsources/rtsp/source_test.go b/internal/staticsources/rtsp/source_test.go index e26bbf9f..8d74deb1 100644 --- a/internal/staticsources/rtsp/source_test.go +++ b/internal/staticsources/rtsp/source_test.go @@ -21,7 +21,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } type testServer struct { diff --git a/internal/stream/rtp_encoder.go b/internal/stream/rtp_encoder.go index 65485f73..ee7428cb 100644 --- a/internal/stream/rtp_encoder.go +++ b/internal/stream/rtp_encoder.go @@ -24,7 +24,9 @@ import ( ) func ptrOf[T any](v T) *T { - return &v + p := new(T) + *p = v + return p } type rtpEncoderNotAvailableError struct {