From 641203107992f7739545df155390fa6032172d00 Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:17:18 +0000 Subject: [PATCH] Update CI configs to v0.11.15 Update lint scripts and CI configs. --- .github/workflows/test.yaml | 6 +++--- .golangci.yml | 8 ++++---- logger.go | 10 +++++----- logging_test.go | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 08e4272..b024289 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 diff --git a/.golangci.yml b/.golangci.yml index e06de4d..a3235be 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,9 @@ # SPDX-FileCopyrightText: 2023 The Pion community # 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 diff --git a/logger.go b/logger.go index f655e52..29fcc99 100644 --- a/logger.go +++ b/logger.go @@ -105,7 +105,7 @@ func (ll *DefaultLeveledLogger) SetLevel(newLevel LogLevel) { // Trace emits the preformatted message if the logger is at or below LogLevelTrace func (ll *DefaultLeveledLogger) Trace(msg string) { - ll.logf(ll.trace, LogLevelTrace, msg) + ll.logf(ll.trace, LogLevelTrace, msg) // nolint: govet } // Tracef formats and emits a message if the logger is at or below LogLevelTrace @@ -115,7 +115,7 @@ func (ll *DefaultLeveledLogger) Tracef(format string, args ...interface{}) { // Debug emits the preformatted message if the logger is at or below LogLevelDebug func (ll *DefaultLeveledLogger) Debug(msg string) { - ll.logf(ll.debug, LogLevelDebug, msg) + ll.logf(ll.debug, LogLevelDebug, msg) // nolint: govet } // Debugf formats and emits a message if the logger is at or below LogLevelDebug @@ -125,7 +125,7 @@ func (ll *DefaultLeveledLogger) Debugf(format string, args ...interface{}) { // Info emits the preformatted message if the logger is at or below LogLevelInfo func (ll *DefaultLeveledLogger) Info(msg string) { - ll.logf(ll.info, LogLevelInfo, msg) + ll.logf(ll.info, LogLevelInfo, msg) // nolint: govet } // Infof formats and emits a message if the logger is at or below LogLevelInfo @@ -135,7 +135,7 @@ func (ll *DefaultLeveledLogger) Infof(format string, args ...interface{}) { // Warn emits the preformatted message if the logger is at or below LogLevelWarn func (ll *DefaultLeveledLogger) Warn(msg string) { - ll.logf(ll.warn, LogLevelWarn, msg) + ll.logf(ll.warn, LogLevelWarn, msg) // nolint: govet } // Warnf formats and emits a message if the logger is at or below LogLevelWarn @@ -145,7 +145,7 @@ func (ll *DefaultLeveledLogger) Warnf(format string, args ...interface{}) { // Error emits the preformatted message if the logger is at or below LogLevelError func (ll *DefaultLeveledLogger) Error(msg string) { - ll.logf(ll.err, LogLevelError, msg) + ll.logf(ll.err, LogLevelError, msg) // nolint: govet } // Errorf formats and emits a message if the logger is at or below LogLevelError diff --git a/logging_test.go b/logging_test.go index daf5302..7f7865e 100644 --- a/logging_test.go +++ b/logging_test.go @@ -35,7 +35,7 @@ func testDebugLevel(t *testing.T, logger *logging.DefaultLeveledLogger) { if !strings.Contains(outBuf.String(), dbgMsg) { t.Errorf("Expected to find %q in %q, but didn't", dbgMsg, outBuf.String()) } - logger.Debugf(dbgMsg) + logger.Debugf(dbgMsg) // nolint: govet if !strings.Contains(outBuf.String(), dbgMsg) { t.Errorf("Expected to find %q in %q, but didn't", dbgMsg, outBuf.String()) } @@ -50,7 +50,7 @@ func testWarnLevel(t *testing.T, logger *logging.DefaultLeveledLogger) { if !strings.Contains(outBuf.String(), warnMsg) { t.Errorf("Expected to find %q in %q, but didn't", warnMsg, outBuf.String()) } - logger.Warnf(warnMsg) + logger.Warnf(warnMsg) // nolint: govet if !strings.Contains(outBuf.String(), warnMsg) { t.Errorf("Expected to find %q in %q, but didn't", warnMsg, outBuf.String()) } @@ -65,7 +65,7 @@ func testErrorLevel(t *testing.T, logger *logging.DefaultLeveledLogger) { if !strings.Contains(outBuf.String(), errMsg) { t.Errorf("Expected to find %q in %q, but didn't", errMsg, outBuf.String()) } - logger.Errorf(errMsg) + logger.Errorf(errMsg) // nolint: govet if !strings.Contains(outBuf.String(), errMsg) { t.Errorf("Expected to find %q in %q, but didn't", errMsg, outBuf.String()) }