Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-37636: [Go] Bump minimum go versions #37637

Merged
merged 16 commits into from
Sep 13, 2023
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ CUDA=11.0.3
DASK=latest
DOTNET=7.0
GCC_VERSION=""
GO=1.17
STATICCHECK=v0.2.2
GO=1.19
STATICCHECK=v0.4.5
HDFS=3.2.1
JDK=8
KARTOTHEK=latest
Expand Down
72 changes: 36 additions & 36 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ jobs:
include:
- arch-label: AMD64
arch: amd64
go: 1.17
go: 1.19
runs-on: ubuntu-latest
staticcheck: v0.2.2
staticcheck: v0.4.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we always use staticcheck v0.4.5. Can we remove this parameter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we only needed it before because you couldn't use latest with go1.17, you had to use v0.2.2, and then we wanted to use the newer versions with go1.18. Now we can use the latest version with go1.19 and go1.20 but instead of using latest it's better to actually pin at v0.4.5. I've removed it from the parameters and just explicitly put it

- arch-label: AMD64
arch: amd64
go: 1.18
go: '1.20'
runs-on: ubuntu-latest
staticcheck: v0.3.3
staticcheck: v0.4.5
- arch-label: ARM64
arch: arm64v8
go: 1.17
staticcheck: v0.2.2
go: 1.19
staticcheck: v0.4.5
runs-on: ["self-hosted", "arm", "linux"]
- arch-label: ARM64
arch: arm64v8
go: 1.18
staticcheck: v0.3.3
go: '1.20'
staticcheck: v0.4.5
runs-on: ["self-hosted", "arm", "linux"]
env:
ARCH: ${{ matrix.arch }}
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
cache: true
cache-dependency-path: go/go.sum
- name: Run build
Expand All @@ -161,12 +161,12 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.17, 1.18]
go: [1.19, '1.20']
include:
- go: 1.17
staticcheck: v0.2.2
- go: 1.18
staticcheck: v0.3.3
- go: 1.19
staticcheck: v0.4.5
- go: '1.20'
staticcheck: v0.4.5
env:
GO: ${{ matrix.go }}
STATICCHECK: ${{ matrix.staticcheck }}
Expand Down Expand Up @@ -208,12 +208,12 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.17, 1.18]
go: [1.19, '1.20']
include:
- go: 1.17
staticcheck: v0.2.2
- go: 1.18
staticcheck: v0.3.3
- go: 1.19
staticcheck: v0.4.5
- go: '1.20'
staticcheck: v0.4.5
env:
GO: ${{ matrix.go }}
STATICCHECK: ${{ matrix.staticcheck }}
Expand Down Expand Up @@ -253,12 +253,12 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.17, 1.18]
go: [1.19, '1.20']
include:
- go: 1.17
staticcheck: v0.2.2
- go: 1.18
staticcheck: v0.3.3
- go: 1.19
staticcheck: v0.4.5
- go: '1.20'
staticcheck: v0.4.5
steps:
- name: Checkout Arrow
uses: actions/checkout@v4
Expand Down Expand Up @@ -288,12 +288,12 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.17, 1.18]
go: [1.19, '1.20']
include:
zeroshade marked this conversation as resolved.
Show resolved Hide resolved
- go: 1.17
staticcheck: v0.2.2
- go: 1.18
staticcheck: v0.3.3
- go: 1.19
staticcheck: v0.4.5
- go: '1.20'
staticcheck: v0.4.5
steps:
- name: Checkout Arrow
uses: actions/checkout@v4
Expand Down Expand Up @@ -349,12 +349,12 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.17, 1.18]
go: [1.19, '1.20']
include:
- go: 1.17
staticcheck: v0.2.2
- go: 1.18
staticcheck: v0.3.3
- go: 1.19
staticcheck: v0.4.5
- go: '1.20'
staticcheck: v0.4.5
env:
ARROW_GO_TESTCGO: "1"
steps:
Expand Down Expand Up @@ -430,11 +430,11 @@ jobs:
- name: Install go
uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.19'
cache: true
cache-dependency-path: go/go.sum
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
run: go install honnef.co/go/tools/cmd/staticcheck@v0.4.5
zeroshade marked this conversation as resolved.
Show resolved Hide resolved
- name: Build
shell: bash
run: ci/scripts/go_build.sh $(pwd)
Expand Down
8 changes: 6 additions & 2 deletions go/internal/hashing/hash_string_go1.19.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import (
)

func hashString(val string, alg uint64) uint64 {
buf := *(*[]byte)(unsafe.Pointer(&val))
(*reflect.SliceHeader)(unsafe.Pointer(&buf)).Cap = len(val)
// highly efficient way to get byte slice without copy before
// the introduction of unsafe.StringData in go1.20
// (https://stackoverflow.com/questions/59209493/how-to-use-unsafe-get-a-byte-slice-from-a-string-without-memory-copy)
const MaxInt32 = 1<<31 - 1
buf := (*[MaxInt32]byte)(unsafe.Pointer((*reflect.StringHeader)(
unsafe.Pointer(&val)).Data))[: len(val)&MaxInt32 : len(val)&MaxInt32]
return Hash(buf, alg)
}