Skip to content

Commit 3d5b701

Browse files
pionbotSean-Der
authored andcommitted
Update CI configs to v0.11.19
Update lint scripts and CI configs.
1 parent c85f51e commit 3d5b701

File tree

28 files changed

+230
-174
lines changed

28 files changed

+230
-174
lines changed

.github/.ci.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PRE_TEST_HOOK=_install_gstreamer_hook
55
PRE_LINT_HOOK=_install_gstreamer_hook
66
GO_MOD_VERSION_EXPECTED=1.22
77
SKIP_i386_TESTS=true
8+
SKIP_API_DIFF=true
89

910
function _install_gstreamer_hook(){
1011
set -e

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
release:
2222
uses: pion/.goassets/.github/workflows/release.reusable.yml@master
2323
with:
24-
go-version: "1.22" # auto-update/latest-go-version
24+
go-version: "1.24" # auto-update/latest-go-version

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: pion/.goassets/.github/workflows/test.reusable.yml@master
2424
strategy:
2525
matrix:
26-
go: ["1.23", "1.22"] # auto-update/supported-go-version-list
26+
go: ["1.24", "1.23"] # auto-update/supported-go-version-list
2727
fail-fast: false
2828
with:
2929
go-version: ${{ matrix.go }}
@@ -33,13 +33,13 @@ jobs:
3333
uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master
3434
strategy:
3535
matrix:
36-
go: ["1.23", "1.22"] # auto-update/supported-go-version-list
36+
go: ["1.24", "1.23"] # auto-update/supported-go-version-list
3737
fail-fast: false
3838
with:
3939
go-version: ${{ matrix.go }}
4040

4141
test-wasm:
4242
uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master
4343
with:
44-
go-version: "1.23" # auto-update/latest-go-version
44+
go-version: "1.24" # auto-update/latest-go-version
4545
secrets: inherit

.github/workflows/tidy-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
tidy:
2323
uses: pion/.goassets/.github/workflows/tidy-check.reusable.yml@master
2424
with:
25-
go-version: "1.22" # auto-update/latest-go-version
25+
go-version: "1.24" # auto-update/latest-go-version

.golangci.yml

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,42 @@ linters-settings:
1919
recommendations:
2020
- errors
2121
forbidigo:
22+
analyze-types: true
2223
forbid:
2324
- ^fmt.Print(f|ln)?$
2425
- ^log.(Panic|Fatal|Print)(f|ln)?$
2526
- ^os.Exit$
2627
- ^panic$
2728
- ^print(ln)?$
29+
- p: ^testing.T.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$
30+
pkg: ^testing$
31+
msg: "use testify/assert instead"
32+
varnamelen:
33+
max-distance: 12
34+
min-name-length: 2
35+
ignore-type-assert-ok: true
36+
ignore-map-index-ok: true
37+
ignore-chan-recv-ok: true
38+
ignore-decls:
39+
- i int
40+
- n int
41+
- w io.Writer
42+
- r io.Reader
43+
- b []byte
2844

2945
linters:
3046
enable:
3147
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
3248
- bidichk # Checks for dangerous unicode character sequences
3349
- bodyclose # checks whether HTTP response body is closed successfully
50+
- containedctx # containedctx is a linter that detects struct contained context.Context field
3451
- contextcheck # check the function whether use a non-inherited context
52+
- cyclop # checks function and package cyclomatic complexity
3553
- decorder # check declaration order and count of types, constants, variables and functions
3654
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
3755
- dupl # Tool for code clone detection
3856
- durationcheck # check for two durations multiplied together
57+
- err113 # Golang linter to check the errors handling expressions
3958
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
4059
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occations, where the check for the returned error can be omitted.
4160
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
@@ -46,66 +65,64 @@ linters:
4665
- forcetypeassert # finds forced type assertions
4766
- gci # Gci control golang package import order and make it always deterministic.
4867
- gochecknoglobals # Checks that no globals are present in Go code
49-
- gochecknoinits # Checks that no init functions are present in Go code
5068
- gocognit # Computes and checks the cognitive complexity of functions
5169
- goconst # Finds repeated strings that could be replaced by a constant
5270
- gocritic # The most opinionated Go source code linter
71+
- gocyclo # Computes and checks the cyclomatic complexity of functions
72+
- godot # Check if comments end in a period
5373
- godox # Tool for detection of FIXME, TODO and other comment keywords
54-
- err113 # Golang linter to check the errors handling expressions
5574
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
5675
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
5776
- goheader # Checks is file header matches to pattern
5877
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
5978
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
60-
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
6179
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
6280
- gosec # Inspects source code for security problems
6381
- gosimple # Linter for Go source code that specializes in simplifying a code
6482
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
6583
- grouper # An analyzer to analyze expression groups.
6684
- importas # Enforces consistent import aliases
6785
- ineffassign # Detects when assignments to existing variables are not used
86+
- lll # Reports long lines
87+
- maintidx # maintidx measures the maintainability index of each function.
88+
- makezero # Finds slice declarations with non-zero initial length
6889
- misspell # Finds commonly misspelled English words in comments
90+
- nakedret # Finds naked returns in functions greater than a specified function length
91+
- nestif # Reports deeply nested if statements
6992
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
7093
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value.
94+
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
7195
- noctx # noctx finds sending http request without context.Context
7296
- predeclared # find code that shadows one of Go's predeclared identifiers
7397
- revive # golint replacement, finds style mistakes
7498
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
7599
- stylecheck # Stylecheck is a replacement for golint
76100
- tagliatelle # Checks the struct tags.
77101
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
78-
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
102+
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
79103
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
80104
- unconvert # Remove unnecessary type conversions
81105
- unparam # Reports unused function parameters
82106
- unused # Checks Go code for unused constants, variables, functions and types
107+
- varnamelen # checks that the length of a variable's name matches its scope
83108
- wastedassign # wastedassign finds wasted assignment statements
84109
- whitespace # Tool for detection of leading and trailing whitespace
85110
disable:
86111
- depguard # Go linter that checks if package imports are in a list of acceptable packages
87-
- containedctx # containedctx is a linter that detects struct contained context.Context field
88-
- cyclop # checks function and package cyclomatic complexity
89112
- funlen # Tool for detection of long functions
90-
- gocyclo # Computes and checks the cyclomatic complexity of functions
91-
- godot # Check if comments end in a period
92-
- gomnd # An analyzer to detect magic numbers.
113+
- gochecknoinits # Checks that no init functions are present in Go code
114+
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
115+
- interfacebloat # A linter that checks length of interface.
93116
- ireturn # Accept Interfaces, Return Concrete Types
94-
- lll # Reports long lines
95-
- maintidx # maintidx measures the maintainability index of each function.
96-
- makezero # Finds slice declarations with non-zero initial length
97-
- nakedret # Finds naked returns in functions greater than a specified function length
98-
- nestif # Reports deeply nested if statements
99-
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
117+
- mnd # An analyzer to detect magic numbers
100118
- nolintlint # Reports ill-formed or insufficient nolint directives
101119
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
102120
- prealloc # Finds slice declarations that could potentially be preallocated
103121
- promlinter # Check Prometheus metrics naming via promlint
104122
- rowserrcheck # checks whether Err of rows is checked successfully
105123
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
106124
- testpackage # linter that makes you use a separate _test package
107-
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
108-
- varnamelen # checks that the length of a variable's name matches its scope
125+
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
109126
- wrapcheck # Checks that errors returned from external packages are wrapped
110127
- wsl # Whitespace Linter - Forces you to use empty lines!
111128

@@ -114,9 +131,12 @@ issues:
114131
exclude-dirs-use-default: false
115132
exclude-rules:
116133
# Allow complex tests and examples, better to be self contained
117-
- path: (examples|main\.go|_test\.go)
134+
- path: (examples|main\.go)
118135
linters:
136+
- gocognit
119137
- forbidigo
138+
- path: _test\.go
139+
linters:
120140
- gocognit
121141

122142
# Allow forbidden identifiers in CLI commands

.reuse/dep5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Files: README.md DESIGN.md **/README.md AUTHORS.txt renovate.json go.mod go.sum
66
Copyright: 2023 The Pion community <https://pion.ly>
77
License: MIT
88

9-
Files: testdata/fuzz/* **/testdata/fuzz/* api/*.txt
9+
Files: testdata/seed/* testdata/fuzz/* **/testdata/fuzz/* api/*.txt
1010
Copyright: 2023 The Pion community <https://pion.ly>
1111
License: CC0-1.0

c-data-channels/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
// are almost identical to the data-channel example that is written in pure Go,
2121
// https://github.com/pion/webrtc/tree/master/examples/data-channels.
2222
// The only difference is that Run lets you to define the OnDataChannel callback in C.
23-
func Run(f func(*webrtc.DataChannel)) {
23+
func Run(f func(*webrtc.DataChannel)) { // nolint
2424
// Everything below is the Pion WebRTC API! Thanks for using it ❤️.
2525

2626
// Prepare the configuration
@@ -86,7 +86,7 @@ func Run(f func(*webrtc.DataChannel)) {
8686

8787
func main() {}
8888

89-
// Read from stdin until we get a newline
89+
// Read from stdin until we get a newline.
9090
func readUntilNewline() (in string) {
9191
var err error
9292

@@ -103,10 +103,11 @@ func readUntilNewline() (in string) {
103103
}
104104

105105
fmt.Println("")
106+
106107
return
107108
}
108109

109-
// JSON encode + base64 a SessionDescription
110+
// JSON encode + base64 a SessionDescription.
110111
func encode(obj *webrtc.SessionDescription) string {
111112
b, err := json.Marshal(obj)
112113
if err != nil {
@@ -116,7 +117,7 @@ func encode(obj *webrtc.SessionDescription) string {
116117
return base64.StdEncoding.EncodeToString(b)
117118
}
118119

119-
// Decode a base64 and unmarshal JSON into a SessionDescription
120+
// Decode a base64 and unmarshal JSON into a SessionDescription.
120121
func decode(in string, obj *webrtc.SessionDescription) {
121122
b, err := base64.StdEncoding.DecodeString(in)
122123
if err != nil {

examples.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func serve(addr string) error {
5151

5252
// Serve the required pages
5353
// DIY 'mux' to avoid additional dependencies
54-
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
55-
url := r.URL.Path
54+
http.HandleFunc("/", func(httpWriter http.ResponseWriter, httpReader *http.Request) {
55+
url := httpReader.URL.Path
5656
// Split up the URL. Expected parts:
5757
// 1: Base url
5858
// 2: "example"
@@ -70,7 +70,8 @@ func serve(addr string) error {
7070
}
7171
fiddle := filepath.Join(exampleLink, "jsfiddle")
7272
if len(parts[4]) != 0 {
73-
http.StripPrefix("/example/"+exampleType+"/"+exampleLink+"/", http.FileServer(http.Dir(fiddle))).ServeHTTP(w, r)
73+
http.StripPrefix("/example/"+exampleType+"/"+exampleLink+"/", http.FileServer(http.Dir(fiddle))).ServeHTTP(httpWriter, httpReader) // nolint
74+
7475
return
7576
}
7677

@@ -88,16 +89,17 @@ func serve(addr string) error {
8889
exampleType == "js",
8990
}
9091

91-
err = temp.Execute(w, data)
92+
err = temp.Execute(httpWriter, data)
9293
if err != nil {
9394
panic(err)
9495
}
96+
9597
return
9698
}
9799
}
98100

99101
// Serve the main page
100-
err = homeTemplate.Execute(w, examples)
102+
err = homeTemplate.Execute(httpWriter, examples)
101103
if err != nil {
102104
panic(err)
103105
}

ffmpeg-send/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var (
106106
err error
107107
)
108108

109-
func writeH264ToTrack(track *webrtc.TrackLocalStaticSample) {
109+
func writeH264ToTrack(track *webrtc.TrackLocalStaticSample) { // nolint
110110
astiav.RegisterAllDevices()
111111

112112
initTestSrc()
@@ -184,7 +184,7 @@ func initTestSrc() {
184184
}
185185

186186
// Open input
187-
if err = inputFormatContext.OpenInput("testsrc=size=640x480:rate=30", astiav.FindInputFormat("lavfi"), nil); err != nil {
187+
if err = inputFormatContext.OpenInput("testsrc=size=640x480:rate=30", astiav.FindInputFormat("lavfi"), nil); err != nil { // nolint
188188
panic(err)
189189
}
190190

@@ -277,7 +277,7 @@ func freeVideoCoding() {
277277
encodePacket.Free()
278278
}
279279

280-
// Read from stdin until we get a newline
280+
// Read from stdin until we get a newline.
281281
func readUntilNewline() (in string) {
282282
var err error
283283

@@ -294,10 +294,11 @@ func readUntilNewline() (in string) {
294294
}
295295

296296
fmt.Println("")
297+
297298
return
298299
}
299300

300-
// JSON encode + base64 a SessionDescription
301+
// JSON encode + base64 a SessionDescription.
301302
func encode(obj *webrtc.SessionDescription) string {
302303
b, err := json.Marshal(obj)
303304
if err != nil {
@@ -307,7 +308,7 @@ func encode(obj *webrtc.SessionDescription) string {
307308
return base64.StdEncoding.EncodeToString(b)
308309
}
309310

310-
// Decode a base64 and unmarshal JSON into a SessionDescription
311+
// Decode a base64 and unmarshal JSON into a SessionDescription.
311312
func decode(in string, obj *webrtc.SessionDescription) {
312313
b, err := base64.StdEncoding.DecodeString(in)
313314
if err != nil {

gstreamer-receive/main.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
//go:build !js
55
// +build !js
66

7-
// gstreamer-receive is a simple application that shows how to receive media using Pion WebRTC and play live using GStreamer.
7+
// gstreamer-receive is a simple application that shows how to
8+
// receive media using Pion WebRTC and play live using GStreamer.
89
package main
910

1011
import (
@@ -53,7 +54,7 @@ func main() {
5354
go func() {
5455
ticker := time.NewTicker(time.Second * 3)
5556
for range ticker.C {
56-
rtcpSendErr := peerConnection.WriteRTCP([]rtcp.Packet{&rtcp.PictureLossIndication{MediaSSRC: uint32(track.SSRC())}})
57+
rtcpSendErr := peerConnection.WriteRTCP([]rtcp.Packet{&rtcp.PictureLossIndication{MediaSSRC: uint32(track.SSRC())}}) // nolint
5758
if rtcpSendErr != nil {
5859
fmt.Println(rtcpSendErr)
5960
}
@@ -119,14 +120,14 @@ func main() {
119120
select {}
120121
}
121122

122-
// Create the appropriate GStreamer pipeline depending on what codec we are working with
123+
// Create the appropriate GStreamer pipeline depending on what codec we are working with.
123124
func pipelineForCodec(track *webrtc.TrackRemote, codecName string) *app.Source {
124125
pipelineString := "appsrc format=time is-live=true do-timestamp=true name=src ! application/x-rtp"
125126
switch strings.ToLower(codecName) {
126127
case "vp8":
127-
pipelineString += fmt.Sprintf(", payload=%d, encoding-name=VP8-DRAFT-IETF-01 ! rtpvp8depay ! decodebin ! autovideosink", track.PayloadType())
128+
pipelineString += fmt.Sprintf(", payload=%d, encoding-name=VP8-DRAFT-IETF-01 ! rtpvp8depay ! decodebin ! autovideosink", track.PayloadType()) // nolint
128129
case "opus":
129-
pipelineString += fmt.Sprintf(", payload=%d, encoding-name=OPUS ! rtpopusdepay ! decodebin ! autoaudiosink", track.PayloadType())
130+
pipelineString += fmt.Sprintf(", payload=%d, encoding-name=OPUS ! rtpopusdepay ! decodebin ! autoaudiosink", track.PayloadType()) // nolint
130131
case "vp9":
131132
pipelineString += " ! rtpvp9depay ! decodebin ! autovideosink"
132133
case "h264":
@@ -154,7 +155,7 @@ func pipelineForCodec(track *webrtc.TrackRemote, codecName string) *app.Source {
154155
return app.SrcFromElement(appSrc)
155156
}
156157

157-
// Read from stdin until we get a newline
158+
// Read from stdin until we get a newline.
158159
func readUntilNewline() (in string) {
159160
var err error
160161

@@ -171,10 +172,11 @@ func readUntilNewline() (in string) {
171172
}
172173

173174
fmt.Println("")
175+
174176
return
175177
}
176178

177-
// JSON encode + base64 a SessionDescription
179+
// JSON encode + base64 a SessionDescription.
178180
func encode(obj *webrtc.SessionDescription) string {
179181
b, err := json.Marshal(obj)
180182
if err != nil {
@@ -184,7 +186,7 @@ func encode(obj *webrtc.SessionDescription) string {
184186
return base64.StdEncoding.EncodeToString(b)
185187
}
186188

187-
// Decode a base64 and unmarshal JSON into a SessionDescription
189+
// Decode a base64 and unmarshal JSON into a SessionDescription.
188190
func decode(in string, obj *webrtc.SessionDescription) {
189191
b, err := base64.StdEncoding.DecodeString(in)
190192
if err != nil {

0 commit comments

Comments
 (0)