From ff41e4c474cf639bb58e7e6839b35240ff7b9ef6 Mon Sep 17 00:00:00 2001 From: Rajiv Singh Date: Tue, 27 Aug 2024 23:12:19 +0530 Subject: [PATCH 1/4] chore: bump versions Signed-off-by: Rajiv Singh --- .github/workflows/build.yml | 14 +++++++------- .github/workflows/release.yml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 686e666..47d7966 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ concurrency: env: # renovate: datasource=go depName=github.com/golangci/golangci-lint - GOLANGCI_LINT_VERSION: v1.52.2 + GOLANGCI_LINT_VERSION: v1.60 jobs: spellcheck: @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Actions Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check spelling of Go files uses: crate-ci/typos@master @@ -36,17 +36,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version-file: .go-version check-latest: true cache: true - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: version: ${{ env.GOLANGCI_LINT_VERSION }} args: --timeout 5m @@ -55,10 +55,10 @@ jobs: name: Go Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version-file: .go-version check-latest: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9bed1b5..370f445 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,16 +15,16 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: .go-version # More assembly might be required: Docker logins, GPG, etc. It all depends # on your needs. - - uses: goreleaser/goreleaser-action@v4 + - uses: goreleaser/goreleaser-action@v6 with: # either 'goreleaser' (default) or 'goreleaser-pro': distribution: goreleaser From dede9bf656f7ec17752605d94e9015121f6a5327 Mon Sep 17 00:00:00 2001 From: Rajiv Singh Date: Wed, 28 Aug 2024 02:12:24 +0530 Subject: [PATCH 2/4] update to go 1.22 Signed-off-by: Rajiv Singh --- .go-version | 2 +- .goreleaser.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.go-version b/.go-version index 0bd54ef..71f7f51 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.20.4 +1.22 diff --git a/.goreleaser.yml b/.goreleaser.yml index c997305..c0ad208 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,7 +13,7 @@ builds: - amd64 - arm64 ldflags: - - -X main.version={{.Version}} + - -X main.version={{.Version}} release: github: From 622a7353cc6a4b292cac90798227d35f3a9a1a19 Mon Sep 17 00:00:00 2001 From: Rajiv Singh Date: Wed, 28 Aug 2024 02:13:06 +0530 Subject: [PATCH 3/4] fix config of depguard Signed-off-by: Rajiv Singh --- .golangci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 977bed4..730cb1c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,7 @@ run: deadline: 7m timeout: 5m - go: '1.20' + go: '1.22' linters: enable: @@ -19,9 +19,12 @@ issues: linters-settings: depguard: - list-type: blacklist - include-go-root: true - packages-with-error-message: [] + rules: + main: + list-mode: lax + deny: + - pkg: github.com/pkg/errors + desc: 'Use errors or fmt instead of github.com/pkg/errors' errcheck: goimports: local-prefixes: github.com/stealthrocket/wzprof From 9ca018607bad8e8037ac381355e16cf64224eed8 Mon Sep 17 00:00:00 2001 From: Rajiv Singh Date: Wed, 28 Aug 2024 02:13:44 +0530 Subject: [PATCH 4/4] reflect.SliceHeade --> unsafe.Slice Signed-off-by: Rajiv Singh --- memory.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/memory.go b/memory.go index bb6e495..ce869a7 100644 --- a/memory.go +++ b/memory.go @@ -4,7 +4,6 @@ package wzprof import ( "fmt" - "reflect" "unsafe" ) @@ -85,8 +84,7 @@ func derefArray[T any](r vmem, p ptr, n uint32) []T { // 64-bits. func derefGoSlice[T any](r vmem, s []T) []T { count := len(s) - sh := (*reflect.SliceHeader)(unsafe.Pointer(&s)) - dp := ptr64(sh.Data) + dp := ptr64(uintptr(unsafe.Pointer(unsafe.SliceData(s)))) // Convert to uintptr first, then to ptr64 res := make([]T, count) for i := 0; i < count; i++ { res[i] = derefArrayIndex[T](r, dp, int32(i))