From d7df52d1fc88f55f70a457f6f7572b4c704e0f4e Mon Sep 17 00:00:00 2001 From: Joonas Kuorilehto Date: Fri, 23 May 2025 19:18:51 +0300 Subject: [PATCH 1/3] Update workflow --- .github/workflows/go.yml | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1395f9a..53ddefd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,44 +1,39 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + name: Go on: push: - branches: [ main ] + branches: [ "main" ] pull_request: - branches: [ main ] + branches: [ "main" ] jobs: build: - name: Build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - - name: Set up Go 1.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v4 with: - go-version: ^1.16 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - go get -v -t -d ./... + go-version: '1.24' - name: Build - run: go build -v . + run: go build -v ./... - name: Test - run: go test -v . + run: go test -v ./... lint: name: "Run static analysis" runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - uses: dominikh/staticcheck-action@v1.2.0 - with: - version: "2022.1.1" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: dominikh/staticcheck-action@v1 + with: + version: "latest" From 30a68b5a2aca03982a0732abb95eb64eb3ed82c9 Mon Sep 17 00:00:00 2001 From: Joonas Kuorilehto Date: Fri, 23 May 2025 16:23:14 +0000 Subject: [PATCH 2/3] Update deps --- go.mod | 9 +++++++-- go.sum | 12 +++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c902f12..8cda51c 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,10 @@ module github.com/joneskoo/ipgrep -go 1.12 +go 1.24 -require inet.af/netaddr v0.0.0-20220811202034-502d2d690317 +require inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a + +require ( + go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect + go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect +) diff --git a/go.sum b/go.sum index 74a1034..5d4098d 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,12 @@ github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go4.org/intern v0.0.0-20211027215823-ae77deb06f29 h1:UXLjNohABv4S58tHmeuIZDO6e3mHpW2Dx33gaNt03LE= go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA= +go4.org/intern v0.0.0-20230525184215-6c62f75575cb h1:ae7kzL5Cfdmcecbh22ll7lYP3iuUdnfnhiPcSaDgH/8= +go4.org/intern v0.0.0-20230525184215-6c62f75575cb/go.mod h1:Ycrt6raEcnF5FTsLiLKkhBTO6DPX3RCUCUVnks3gFJU= go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= -go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 h1:FyBZqvoA/jbNzuAWLQE2kG820zMAkcilx6BMjGbL/E4= -go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 h1:lGdhQUN/cnWdSH3291CUuxSEqc+AsGTiDxPP3r2J0l4= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -26,5 +28,5 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -inet.af/netaddr v0.0.0-20220811202034-502d2d690317 h1:U2fwK6P2EqmopP/hFLTOAjWTki0qgd4GMJn5X8wOleU= -inet.af/netaddr v0.0.0-20220811202034-502d2d690317/go.mod h1:OIezDfdzOgFhuw4HuWapWq2e9l0H9tK4F1j+ETRtF3k= +inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a h1:1XCVEdxrvL6c0TGOhecLuB7U9zYNdxZEjvOqJreKZiM= +inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a/go.mod h1:e83i32mAQOW1LAqEIweALsuK2Uw4mhQadA5r7b0Wobo= From 246d500ccb245dd3c990d2c3e2b1aa40be494946 Mon Sep 17 00:00:00 2001 From: Joonas Kuorilehto Date: Fri, 23 May 2025 16:25:15 +0000 Subject: [PATCH 3/3] Update ioutil to io --- ipgrep_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ipgrep_test.go b/ipgrep_test.go index 1c0f155..914d7fc 100755 --- a/ipgrep_test.go +++ b/ipgrep_test.go @@ -22,7 +22,8 @@ package ipgrep_test import ( "bytes" - "io/ioutil" + "io" + "os" "strings" "testing" @@ -210,13 +211,13 @@ func TestIpgrep(t *testing.T) { func BenchmarkGrepMMask(b *testing.B) { b.ReportAllocs() - input, err := ioutil.ReadFile("README.md") + input, err := os.ReadFile("README.md") if err != nil { b.Errorf("Failed to read README.md: %v", err) } for i := 0; i < b.N; i++ { br := bytes.NewReader(input) - err := ipgrep.Grep(br, ioutil.Discard, "1.2.3.4m255.255.255.0") + err := ipgrep.Grep(br, io.Discard, "1.2.3.4m255.255.255.0") if err != nil { b.Errorf("Grep failed unexpectedly: %v", err) } @@ -225,13 +226,13 @@ func BenchmarkGrepMMask(b *testing.B) { func BenchmarkGrepCIDR(b *testing.B) { b.ReportAllocs() - input, err := ioutil.ReadFile("README.md") + input, err := os.ReadFile("README.md") if err != nil { b.Errorf("Failed to read README.md: %v", err) } for i := 0; i < b.N; i++ { br := bytes.NewReader(input) - err := ipgrep.Grep(br, ioutil.Discard, "1.2.3.4/24") + err := ipgrep.Grep(br, io.Discard, "1.2.3.4/24") if err != nil { b.Errorf("Grep failed unexpectedly: %v", err) } @@ -240,13 +241,13 @@ func BenchmarkGrepCIDR(b *testing.B) { func BenchmarkGrepIP(b *testing.B) { b.ReportAllocs() - input, err := ioutil.ReadFile("README.md") + input, err := os.ReadFile("README.md") if err != nil { b.Errorf("Failed to read README.md: %v", err) } for i := 0; i < b.N; i++ { br := bytes.NewReader(input) - err := ipgrep.Grep(br, ioutil.Discard, "1.2.3.4") + err := ipgrep.Grep(br, io.Discard, "1.2.3.4") if err != nil { b.Errorf("Grep failed unexpectedly: %v", err) }