From 37ef53c7bbb64da86820f85f1128d73b00e8de4a Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 8 Nov 2026 00:56:25 +0000 Subject: [PATCH 1/3] ci: use Go 1.27 and pin GitHub Actions to commit SHAs Amp-Thread-ID: https://ampcode.com/threads/T-01a1b893-07c3-7507-afd4-7e8161140208 Co-authored-by: Amp --- .github/workflows/go.yml | 18 +++++++++++------- .golangci.yml | 38 +++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d9b5f33..16c4d81 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -22,9 +22,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: 1.27.x - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: version: latest args: --timeout=30m @@ -33,20 +37,20 @@ jobs: name: Test strategy: matrix: - go-version: [ 1.20.x, 1.21.x ] + go-version: [ 1.27.x ] platform: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.platform }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: ${{ matrix.go-version }} - name: Run tests with coverage run: go test -shuffle=on -v -race -coverprofile=coverage -covermode=atomic ./... - name: Upload coverage report to Codecov - uses: codecov/codecov-action@v1.5.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: - file: ./coverage + files: ./coverage flags: unittests diff --git a/.golangci.yml b/.golangci.yml index 82dd9ef..6937629 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,19 +1,31 @@ -linters-settings: - nakedret: - max-func-lines: 0 # Disallow any unnamed return statement - +version: "2" linters: enable: - - unused - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - typecheck - nakedret - - gofmt - rowserrcheck - unconvert - - goimports - unparam + settings: + nakedret: + max-func-lines: 0 # Disallow any unnamed return statement + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From 830eefe2e9d950eb8efc9714a75e5a54a6adb046 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 8 Nov 2026 01:35:58 +0000 Subject: [PATCH 2/3] ci: align golangci-lint config with flamego/flamego Amp-Thread-ID: https://ampcode.com/threads/T-01a1b893-07c3-7507-afd4-7e8161140208 Co-authored-by: Amp --- .golangci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 6937629..c8c1f59 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,12 @@ linters: - unconvert - unparam settings: + staticcheck: + checks: + - all + - "-SA1019" # This project is under active refactoring and not all code is up to date. + - "-QF1001" # I'm a math noob + - "-ST1016" # Some legit code uses this pattern nakedret: max-func-lines: 0 # Disallow any unnamed return statement exclusions: From c1960efab899d82fb1a23ffbf89e617f6d9c9989 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 8 Nov 2026 14:20:02 +0000 Subject: [PATCH 3/3] ci: drop SA1019 and ST1016 exclusions from golangci-lint config Amp-Thread-ID: https://ampcode.com/threads/T-01a1b893-07c3-7507-afd4-7e8161140208 Co-authored-by: Amp --- .golangci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c8c1f59..e49a45f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,9 +9,7 @@ linters: staticcheck: checks: - all - - "-SA1019" # This project is under active refactoring and not all code is up to date. - "-QF1001" # I'm a math noob - - "-ST1016" # Some legit code uses this pattern nakedret: max-func-lines: 0 # Disallow any unnamed return statement exclusions: