mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Update CI configs to v0.11.15
Update lint scripts and CI configs.
This commit is contained in:
6
.github/workflows/test.yaml
vendored
6
.github/workflows/test.yaml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
uses: pion/.goassets/.github/workflows/test.reusable.yml@master
|
||||
strategy:
|
||||
matrix:
|
||||
go: ["1.22", "1.21"] # auto-update/supported-go-version-list
|
||||
go: ["1.23", "1.22"] # auto-update/supported-go-version-list
|
||||
fail-fast: false
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master
|
||||
strategy:
|
||||
matrix:
|
||||
go: ["1.22", "1.21"] # auto-update/supported-go-version-list
|
||||
go: ["1.23", "1.22"] # auto-update/supported-go-version-list
|
||||
fail-fast: false
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
@@ -41,5 +41,5 @@ jobs:
|
||||
test-wasm:
|
||||
uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master
|
||||
with:
|
||||
go-version: "1.22" # auto-update/latest-go-version
|
||||
go-version: "1.23" # auto-update/latest-go-version
|
||||
secrets: inherit
|
||||
|
@@ -1,6 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
enable:
|
||||
@@ -48,7 +51,7 @@ linters:
|
||||
- goconst # Finds repeated strings that could be replaced by a constant
|
||||
- gocritic # The most opinionated Go source code linter
|
||||
- godox # Tool for detection of FIXME, TODO and other comment keywords
|
||||
- goerr113 # Golang linter to check the errors handling expressions
|
||||
- err113 # Golang linter to check the errors handling expressions
|
||||
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
|
||||
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
|
||||
- goheader # Checks is file header matches to pattern
|
||||
@@ -83,17 +86,14 @@ linters:
|
||||
- depguard # Go linter that checks if package imports are in a list of acceptable packages
|
||||
- containedctx # containedctx is a linter that detects struct contained context.Context field
|
||||
- cyclop # checks function and package cyclomatic complexity
|
||||
- exhaustivestruct # Checks if all struct's fields are initialized
|
||||
- funlen # Tool for detection of long functions
|
||||
- gocyclo # Computes and checks the cyclomatic complexity of functions
|
||||
- godot # Check if comments end in a period
|
||||
- gomnd # An analyzer to detect magic numbers.
|
||||
- ifshort # Checks that your code uses short syntax for if-statements whenever possible
|
||||
- ireturn # Accept Interfaces, Return Concrete Types
|
||||
- lll # Reports long lines
|
||||
- maintidx # maintidx measures the maintainability index of each function.
|
||||
- makezero # Finds slice declarations with non-zero initial length
|
||||
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted
|
||||
- nakedret # Finds naked returns in functions greater than a specified function length
|
||||
- nestif # Reports deeply nested if statements
|
||||
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
|
||||
|
@@ -73,13 +73,13 @@ func TestDataChannel_MessagesAreOrdered(t *testing.T) {
|
||||
api := NewAPI()
|
||||
dc := &DataChannel{api: api}
|
||||
|
||||
max := 512
|
||||
maxVal := 512
|
||||
out := make(chan int)
|
||||
inner := func(msg DataChannelMessage) {
|
||||
// randomly sleep
|
||||
// math/rand a weak RNG, but this does not need to be secure. Ignore with #nosec
|
||||
/* #nosec */
|
||||
randInt, err := rand.Int(rand.Reader, big.NewInt(int64(max)))
|
||||
randInt, err := rand.Int(rand.Reader, big.NewInt(int64(maxVal)))
|
||||
/* #nosec */ if err != nil {
|
||||
t.Fatalf("Failed to get random sleep duration: %s", err)
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func TestDataChannel_MessagesAreOrdered(t *testing.T) {
|
||||
})
|
||||
|
||||
go func() {
|
||||
for i := 1; i <= max; i++ {
|
||||
for i := 1; i <= maxVal; i++ {
|
||||
buf := make([]byte, 8)
|
||||
binary.PutVarint(buf, int64(i))
|
||||
dc.onMessage(DataChannelMessage{Data: buf})
|
||||
@@ -107,16 +107,16 @@ func TestDataChannel_MessagesAreOrdered(t *testing.T) {
|
||||
}
|
||||
}()
|
||||
|
||||
values := make([]int, 0, max)
|
||||
values := make([]int, 0, maxVal)
|
||||
for v := range out {
|
||||
values = append(values, v)
|
||||
if len(values) == max {
|
||||
if len(values) == maxVal {
|
||||
close(out)
|
||||
}
|
||||
}
|
||||
|
||||
expected := make([]int, max)
|
||||
for i := 1; i <= max; i++ {
|
||||
expected := make([]int, maxVal)
|
||||
for i := 1; i <= maxVal; i++ {
|
||||
expected[i-1] = i
|
||||
}
|
||||
assert.EqualValues(t, expected, values)
|
||||
|
@@ -38,7 +38,7 @@ func doSignaling(w http.ResponseWriter, r *http.Request) {
|
||||
d.OnOpen(func() {
|
||||
for range time.Tick(time.Second * 3) {
|
||||
if err = d.SendText(time.Now().String()); err != nil {
|
||||
if errors.Is(io.ErrClosedPipe, err) {
|
||||
if errors.Is(err, io.ErrClosedPipe) {
|
||||
return
|
||||
}
|
||||
panic(err)
|
||||
|
@@ -228,7 +228,7 @@ func writeFileToTrack(ivf *ivfreader.IVFReader, header *ivfreader.IVFFileHeader,
|
||||
frame, _, err := ivf.ParseNextFrame()
|
||||
if errors.Is(err, io.EOF) {
|
||||
fmt.Printf("All video frames parsed and sent")
|
||||
os.Exit(0)
|
||||
os.Exit(0) //nolint: gocritic
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@@ -259,7 +259,7 @@ func TestPeerConnection_GracefulCloseWhileOpening(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := pcOffer.CreateDataChannel("initial_data_channel", nil); err != nil {
|
||||
if _, err = pcOffer.CreateDataChannel("initial_data_channel", nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ func Test_RTPSender_ReplaceTrack(t *testing.T) {
|
||||
for {
|
||||
pkt, _, err := track.ReadRTP()
|
||||
if err != nil {
|
||||
assert.True(t, errors.Is(io.EOF, err))
|
||||
assert.True(t, errors.Is(err, io.EOF))
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -423,12 +423,12 @@ func (r *SCTPTransport) generateAndSetDataChannelID(dtlsRole DTLSRole, idOut **u
|
||||
id++
|
||||
}
|
||||
|
||||
max := r.MaxChannels()
|
||||
maxVal := r.MaxChannels()
|
||||
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
|
||||
for ; id < max-1; id += 2 {
|
||||
for ; id < maxVal-1; id += 2 {
|
||||
if _, ok := r.dataChannelIDsUsed[id]; ok {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user