Skip to content

Commit

Permalink
Update CI configs to v0.11.15
Browse files Browse the repository at this point in the history
Update lint scripts and CI configs.
  • Loading branch information
pionbot authored and Sean-Der committed Aug 16, 2024
1 parent 4aac982 commit 114df0d
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -33,13 +33,13 @@ 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 }}

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
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

run:
timeout: 5m

linters-settings:
govet:
enable:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion codecs/av1_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (p *AV1Payloader) Payload(mtu uint16, payload []byte) (payloads [][]byte) {
metadataSize += leb128Size + len(p.sequenceHeader)
}

out := make([]byte, min(int(mtu), payloadDataRemaining+metadataSize))
out := make([]byte, minInt(int(mtu), payloadDataRemaining+metadataSize))
outOffset := av1PayloaderHeadersize
out[0] = obuCount << wBitshift

Expand Down
2 changes: 1 addition & 1 deletion codecs/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package codecs

func min(a, b int) int {
func minInt(a, b int) int {
if a < b {
return a
}
Expand Down
6 changes: 3 additions & 3 deletions codecs/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import (
)

func TestCommon_Min(t *testing.T) {
res := min(1, -1)
res := minInt(1, -1)
if res != -1 {
t.Fatal("Error: -1 < 1")
}

res = min(1, 2)
res = minInt(1, 2)
if res != 1 {
t.Fatal("Error: 1 < 2")
}

res = min(3, 3)
res = minInt(3, 3)
if res != 3 {
t.Fatal("Error: 3 == 3")
}
Expand Down
4 changes: 2 additions & 2 deletions codecs/h264_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ func (p *H264Payloader) Payload(mtu uint16, payload []byte) [][]byte {
naluLength := len(nalu) - naluIndex
naluRemaining := naluLength

if min(maxFragmentSize, naluRemaining) <= 0 {
if minInt(maxFragmentSize, naluRemaining) <= 0 {
return
}

for naluRemaining > 0 {
currentFragmentSize := min(maxFragmentSize, naluRemaining)
currentFragmentSize := minInt(maxFragmentSize, naluRemaining)
out := make([]byte, fuaHeaderSize+currentFragmentSize)

// +---------------+
Expand Down
4 changes: 2 additions & 2 deletions codecs/vp8_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ func (p *VP8Payloader) Payload(mtu uint16, payload []byte) [][]byte {
var payloads [][]byte

// Make sure the fragment/payload size is correct
if min(maxFragmentSize, payloadDataRemaining) <= 0 {
if minInt(maxFragmentSize, payloadDataRemaining) <= 0 {
return payloads
}
first := true
for payloadDataRemaining > 0 {
currentFragmentSize := min(maxFragmentSize, payloadDataRemaining)
currentFragmentSize := minInt(maxFragmentSize, payloadDataRemaining)
out := make([]byte, usingHeaderSize+currentFragmentSize)

if first {
Expand Down
6 changes: 3 additions & 3 deletions codecs/vp9_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ func (p *VP9Payloader) payloadFlexible(mtu uint16, payload []byte) [][]byte {
payloadDataIndex := 0
var payloads [][]byte

if min(maxFragmentSize, payloadDataRemaining) <= 0 {
if minInt(maxFragmentSize, payloadDataRemaining) <= 0 {
return [][]byte{}
}

for payloadDataRemaining > 0 {
currentFragmentSize := min(maxFragmentSize, payloadDataRemaining)
currentFragmentSize := minInt(maxFragmentSize, payloadDataRemaining)
out := make([]byte, headerSize+currentFragmentSize)

out[0] = 0x90 // F=1, I=1
Expand Down Expand Up @@ -149,7 +149,7 @@ func (p *VP9Payloader) payloadNonFlexible(mtu uint16, payload []byte) [][]byte {
}

maxFragmentSize := int(mtu) - headerSize
currentFragmentSize := min(maxFragmentSize, payloadDataRemaining)
currentFragmentSize := minInt(maxFragmentSize, payloadDataRemaining)
if currentFragmentSize <= 0 {
return [][]byte{}
}
Expand Down
2 changes: 1 addition & 1 deletion header_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ type TwoByteHeaderExtension struct {

// Set sets the extension payload for the specified ID.
func (e *TwoByteHeaderExtension) Set(id uint8, buf []byte) error {
if id < 1 || id > 255 {
if id < 1 {
return fmt.Errorf("%w actual(%d)", errRFC8285TwoByteHeaderIDRange, id)
}
if len(buf) > 255 {
Expand Down
2 changes: 1 addition & 1 deletion packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (h *Header) SetExtension(id uint8, payload []byte) error { //nolint:gocogni
}
// RFC 8285 RTP Two Byte Header Extension
case extensionProfileTwoByte:
if id < 1 || id > 255 {
if id < 1 {
return fmt.Errorf("%w actual(%d)", errRFC8285TwoByteHeaderIDRange, id)
}
if len(payload) > 255 {
Expand Down

0 comments on commit 114df0d

Please sign in to comment.