From 037ff41ac34bdab2c27fefb2548e8a4ba12b5ce8 Mon Sep 17 00:00:00 2001 From: Pires Date: Tue, 8 Oct 2024 13:02:18 +0100 Subject: [PATCH 1/2] lint: replace math/rand.Read with crypto/rand.Read --- v2_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2_test.go b/v2_test.go index 57592b3..7fef556 100644 --- a/v2_test.go +++ b/v2_test.go @@ -3,6 +3,7 @@ package proxyproto import ( "bufio" "bytes" + iorand "crypto/rand" "encoding/binary" "math/rand" "reflect" @@ -51,7 +52,7 @@ var ( fixtureUnixV2 = append(lengthUnixBytes, fixtureUnixAddress...) fixtureTLV = func() []byte { tlv := make([]byte, 2+rand.Intn(1<<12)) // Not enough to overflow, at least size two - rand.Read(tlv) + _, _ = iorand.Read(tlv) return tlv }() fixtureIPv4V2TLV = fixtureWithTLV(lengthV4Bytes, fixtureIPv4Address, fixtureTLV) From a2b5b3bfa11331df1b08f41fde98a963fc6df681 Mon Sep 17 00:00:00 2001 From: Pires Date: Tue, 8 Oct 2024 13:04:56 +0100 Subject: [PATCH 2/2] ci: bump golangci-lint action --- .github/workflows/golangci-lint.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5476438..61d2180 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -9,9 +9,12 @@ on: pull_request: permissions: + # Required: allow read access to the content for analysis. contents: read # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read + pull-requests: read + # Optional: allow write access to checks to allow the action to annotate code in the PR. + checks: write jobs: golangci: @@ -21,10 +24,10 @@ jobs: matrix: go: ['1.19', '1.20'] steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Format run: go fmt @@ -33,7 +36,7 @@ jobs: run: go vet - name: lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 #with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version #version: v1.29