-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change go version to 1.20 for Windows 7 support
- Loading branch information
Showing
12 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/AlexxIT/go2rtc | ||
|
||
go 1.22 | ||
go 1.20 | ||
|
||
require ( | ||
github.com/asticode/go-astits v1.13.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package core | ||
|
||
// This code copied from go1.21 for backward support in go1.20. | ||
// We need to support go1.20 for Windows 7 | ||
|
||
// Index returns the index of the first occurrence of v in s, | ||
// or -1 if not present. | ||
func Index[S ~[]E, E comparable](s S, v E) int { | ||
for i := range s { | ||
if v == s[i] { | ||
return i | ||
} | ||
} | ||
return -1 | ||
} | ||
|
||
// Contains reports whether v is present in s. | ||
func Contains[S ~[]E, E comparable](s S, v E) bool { | ||
return Index(s, v) >= 0 | ||
} | ||
|
||
type Ordered interface { | ||
~int | ~int8 | ~int16 | ~int32 | ~int64 | | ||
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | | ||
~float32 | ~float64 | | ||
~string | ||
} | ||
|
||
// Max returns the maximal value in x. It panics if x is empty. | ||
// For floating-point E, Max propagates NaNs (any NaN value in x | ||
// forces the output to be NaN). | ||
func Max[S ~[]E, E Ordered](x S) E { | ||
if len(x) < 1 { | ||
panic("slices.Max: empty list") | ||
} | ||
m := x[0] | ||
for i := 1; i < len(x); i++ { | ||
if x[i] > m { | ||
m = x[i] | ||
} | ||
} | ||
return m | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ package homekit | |
import ( | ||
"fmt" | ||
"io" | ||
"math/rand/v2" | ||
"math/rand" | ||
"net" | ||
"time" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters