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 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/.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 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: 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))