From 56498a0e8b30f9d3c0ad43de7115fb6767688a02 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Wed, 27 Mar 2024 11:40:24 -0400 Subject: [PATCH] chore(go/adbc): bump minimum version to go1.21, update deps (#1646) Bumping the minimum go version (via go.mod) to go1.21 and updated appropriate indirect dependencies accordingly. --------- Co-authored-by: Sutou Kouhei --- .env | 2 +- .github/workflows/integration.yml | 10 ++- .github/workflows/native-unix.yml | 31 ++++++--- .github/workflows/native-windows.yml | 10 ++- .github/workflows/packaging.yml | 9 ++- .github/workflows/r-check.yml | 5 +- .pre-commit-config.yaml | 2 +- ci/conda/meta.yaml | 2 +- ci/docker/python-wheel-manylinux.dockerfile | 8 ++- ci/linux-packages/Rakefile | 13 +++- .../apt/debian-bookworm/Dockerfile | 3 +- .../apt/debian-bullseye/Dockerfile | 65 ------------------- ci/linux-packages/apt/ubuntu-jammy/Dockerfile | 2 +- ci/linux-packages/debian/control | 2 +- ci/linux-packages/debian/rules | 2 +- ci/linux-packages/yum/almalinux-8/Dockerfile | 8 ++- ci/linux-packages/yum/almalinux-9/Dockerfile | 9 ++- .../yum/apache-arrow-adbc.spec.in | 1 - ci/scripts/cpp_recipe.sh | 2 +- ci/scripts/cpp_test.sh | 1 - dev/release/verify-release-candidate.sh | 13 ++-- docker-compose.yml | 2 + go/adbc/driver/flightsql/logging.go | 2 +- .../driver/internal/driverbase/connection.go | 2 +- .../driver/internal/driverbase/database.go | 2 +- .../driver/internal/driverbase/driver_test.go | 3 +- go/adbc/driver/internal/driverbase/logging.go | 3 +- go/adbc/ext.go | 2 +- go/adbc/go.mod | 21 +++--- go/adbc/go.sum | 47 ++++++++++++++ go/adbc/pkg/_tmpl/driver.go.tmpl | 21 +++--- go/adbc/pkg/doc.go | 1 + go/adbc/pkg/flightsql/driver.go | 21 +++--- go/adbc/pkg/panicdummy/driver.go | 33 +++++----- go/adbc/pkg/snowflake/driver.go | 21 +++--- go/adbc/sqldriver/driver.go | 4 +- r/adbcflightsql/DESCRIPTION | 2 +- r/adbcflightsql/tools/download-go.R | 2 +- r/adbcsnowflake/DESCRIPTION | 2 +- 39 files changed, 212 insertions(+), 179 deletions(-) delete mode 100644 ci/linux-packages/apt/debian-bullseye/Dockerfile diff --git a/.env b/.env index 0b5e04d6e0..c1faa4be27 100644 --- a/.env +++ b/.env @@ -32,7 +32,7 @@ JDK=8 MANYLINUX=2014 MAVEN=3.6.3 PYTHON=3.8 -GO=1.19.5 +GO=1.21.8 ARROW_MAJOR_VERSION=14 DOTNET=7.0 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d34f721070..1a0c6f858e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -110,6 +110,9 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -135,7 +138,7 @@ jobs: pip install pytest-error-for-skips - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum @@ -305,6 +308,9 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -333,7 +339,7 @@ jobs: sudo sysctl vm.mmap_rnd_bits=28 - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum diff --git a/.github/workflows/native-unix.yml b/.github/workflows/native-unix.yml index 2f4152de3c..57fe0167d2 100644 --- a/.github/workflows/native-unix.yml +++ b/.github/workflows/native-unix.yml @@ -80,6 +80,9 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -103,7 +106,7 @@ jobs: --file ci/conda_env_cpp.txt - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum @@ -117,7 +120,7 @@ jobs: export ADBC_BUILD_TESTS=OFF export ADBC_USE_ASAN=OFF export ADBC_USE_UBSAN=OFF - export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/${{ matrix.goarch }}/bin:$PATH + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/${{ matrix.goarch }}/bin:$PATH export ADBC_CMAKE_ARGS="-DCMAKE_UNITY_BUILD=ON" ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" - name: Go Build @@ -125,7 +128,7 @@ jobs: env: CGO_ENABLED: "1" run: | - export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/${{ matrix.goarch }}/bin:$PATH + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/${{ matrix.goarch }}/bin:$PATH ./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" - uses: actions/upload-artifact@v3 @@ -332,7 +335,7 @@ jobs: sudo sysctl vm.mmap_rnd_bits=28 - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3 + run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Go Build run: | ./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" @@ -370,6 +373,9 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -399,14 +405,14 @@ jobs: --file ci/conda_env_cpp.txt - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum - name: Install staticcheck shell: bash -l {0} if: matrix.os == 'ubuntu-latest' - run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3 + run: go install honnef.co/go/tools/cmd/staticcheck@latest - uses: actions/download-artifact@v3 with: @@ -416,7 +422,7 @@ jobs: - name: Go Build shell: bash -l {0} run: | - export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/${{ matrix.goarch }}/bin:$PATH + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/${{ matrix.goarch }}/bin:$PATH ./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" - name: Run Staticcheck if: matrix.os == 'ubuntu-latest' @@ -430,7 +436,7 @@ jobs: env: SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }} run: | - export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/${{ matrix.goarch }}/bin:$PATH + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/${{ matrix.goarch }}/bin:$PATH ./ci/scripts/go_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local" # ------------------------------------------------------------ @@ -454,6 +460,9 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -484,7 +493,7 @@ jobs: sudo sysctl vm.mmap_rnd_bits=28 - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum @@ -501,10 +510,12 @@ jobs: ADBC_USE_ASAN: "0" ADBC_USE_UBSAN: "0" run: | + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/x64/bin:$PATH ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" - name: Build Panic Dummy shell: bash -l {0} run: | + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/x64/bin:$PATH if [[ $(uname) = "Darwin" ]]; then make -C ./go/adbc/pkg libadbc_driver_panicdummy.dylib else @@ -518,10 +529,12 @@ jobs: else export PANICDUMMY_LIBRARY_PATH=$(pwd)/go/adbc/pkg/libadbc_driver_panicdummy.so fi + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/x64/bin:$PATH env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local" - name: Test Python Driver Flight SQL shell: bash -l {0} run: | + export PATH=$RUNNER_TOOL_CACHE/go/${GO_VERSION}/x64/bin:$PATH # Can't use Docker on macOS pushd $(pwd)/go/adbc go build -o testserver ./driver/flightsql/cmd/testserver diff --git a/.github/workflows/native-windows.yml b/.github/workflows/native-windows.yml index 57ff371ae0..097f316d03 100644 --- a/.github/workflows/native-windows.yml +++ b/.github/workflows/native-windows.yml @@ -198,6 +198,10 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Get required Go version + shell: bash + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - name: Get Date id: get-date shell: bash @@ -223,7 +227,7 @@ jobs: --file ci/conda_env_cpp.txt - uses: actions/setup-go@v5 with: - go-version: 1.20.8 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: go/adbc/go.sum @@ -238,7 +242,7 @@ jobs: env: CGO_ENABLED: "1" run: | - $env:PATH="$($env:RUNNER_TOOL_CACHE)\go\1.20.8\x64\bin;" + $env:PATH + $env:PATH="${env:RUNNER_TOOL_CACHE}\go\${env:GO_VERSION}\x64\bin;${env:PATH}" .\ci\scripts\go_build.ps1 $pwd $pwd\build # TODO(apache/arrow#358): enable these tests on Windows # - name: Go Test @@ -246,7 +250,7 @@ jobs: # env: # CGO_ENABLED: "1" # run: | - # $env:PATH="$($env:RUNNER_TOOL_CACHE)\go\1.20.8\x64\bin;" + $env:PATH + # $env:PATH="${env:RUNNER_TOOL_CACHE}\go\${env:GO_VERSION}\x64\bin;${env:PATH}" # .\ci\scripts\go_test.ps1 $pwd $pwd\build # ------------------------------------------------------------ diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 31bc168159..6ec81c1fe4 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -265,7 +265,6 @@ jobs: - almalinux-8 - almalinux-9 - debian-bookworm - - debian-bullseye - ubuntu-jammy steps: - uses: actions/download-artifact@v3 @@ -686,7 +685,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: 1.19.13 + go-version: 1.21.8 check-latest: true cache: true cache-dependency-path: adbc/go/adbc/go.sum @@ -812,6 +811,8 @@ jobs: tar xf apache-arrow-adbc-${VERSION}.tar.gz mv apache-arrow-adbc-${VERSION} adbc + (. adbc/.env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV + - name: Show inputs shell: pwsh run: | @@ -841,11 +842,9 @@ jobs: .\bootstrap-vcpkg.bat -disableMetrics popd - # Windows needs newer Go than 1.19 - # https://github.com/golang/go/issues/51007 - uses: actions/setup-go@v5 with: - go-version: 1.20.8 + go-version: "${{ env.GO_VERSION }}" check-latest: true cache: true cache-dependency-path: adbc/go/adbc/go.sum diff --git a/.github/workflows/r-check.yml b/.github/workflows/r-check.yml index e29f7f3ed7..0b368ca330 100644 --- a/.github/workflows/r-check.yml +++ b/.github/workflows/r-check.yml @@ -41,9 +41,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get required Go version + run: | + (. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: "${{ env.GO_VERSION }}" - uses: r-lib/actions/setup-r@v2 with: r-version: release diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb3a19cdae..17ac98a2be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,7 +59,7 @@ repos: - "--linelength=90" - "--verbose=2" - repo: https://github.com/golangci/golangci-lint - rev: v1.49.0 + rev: v1.57.1 hooks: - id: golangci-lint entry: bash -c 'cd go/adbc && golangci-lint run --fix --timeout 5m' diff --git a/ci/conda/meta.yaml b/ci/conda/meta.yaml index a499f6b768..3b5a6af801 100644 --- a/ci/conda/meta.yaml +++ b/ci/conda/meta.yaml @@ -63,7 +63,7 @@ outputs: - {{ compiler('cxx') }} - _go_select *=cgo - cmake - - go-cgo >=1.19 + - go-cgo >=1.21 - ninja - pkg-config test: diff --git a/ci/docker/python-wheel-manylinux.dockerfile b/ci/docker/python-wheel-manylinux.dockerfile index 38d3b27b1c..2ebfb68266 100644 --- a/ci/docker/python-wheel-manylinux.dockerfile +++ b/ci/docker/python-wheel-manylinux.dockerfile @@ -24,9 +24,11 @@ ARG VCPKG FROM ${REPO}:${ARCH}-python-${PYTHON}-wheel-manylinux-${MANYLINUX}-vcpkg-${VCPKG} ARG ARCH +ARG GO RUN yum install -y docker # arm64v8 -> arm64 -RUN wget --no-verbose https://go.dev/dl/go1.19.13.linux-${ARCH/v8/}.tar.gz -RUN tar -C /usr/local -xzf go1.19.13.linux-${ARCH/v8/}.tar.gz -ENV PATH="${PATH}:/usr/local/go/bin" +RUN wget --no-verbose https://go.dev/dl/go${GO}.linux-${ARCH/v8/}.tar.gz && \ + tar -C /usr/local -xzf go${GO}.linux-${ARCH/v8/}.tar.gz && \ + rm go${GO}.linux-${ARCH/v8/}.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" diff --git a/ci/linux-packages/Rakefile b/ci/linux-packages/Rakefile index 674d936053..3945c11119 100644 --- a/ci/linux-packages/Rakefile +++ b/ci/linux-packages/Rakefile @@ -104,10 +104,19 @@ class ADBCPackageTask < PackageTask end end + def detect_go_version + dot_env = File.join(__dir__, "..", "..", ".env") + File.readlines(dot_env, chomp: true).grep(/\AGO=/)[0].split("=", 2)[1] + end + + def docker_build_options(os, architecture) + [ + "--build-arg", "GO_VERSION=#{detect_go_version}", + ] + end + def apt_targets_default [ - "debian-bullseye", - # "debian-bullseye-arm64", "debian-bookworm", # "debian-bookworm-arm64", "ubuntu-jammy", diff --git a/ci/linux-packages/apt/debian-bookworm/Dockerfile b/ci/linux-packages/apt/debian-bookworm/Dockerfile index aa85e28208..2b8a3a89ac 100644 --- a/ci/linux-packages/apt/debian-bookworm/Dockerfile +++ b/ci/linux-packages/apt/debian-bookworm/Dockerfile @@ -40,6 +40,7 @@ RUN \ apt install -y -V ${quiet} \ ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ + echo "deb http://deb.debian.org/debian $(lsb_release --codename --short)-backports main" >> /etc/apt/sources.list && \ apt update && \ apt install -y -V ${quiet} \ build-essential \ @@ -48,7 +49,6 @@ RUN \ debhelper \ devscripts \ gobject-introspection \ - golang \ libarrow-glib-dev \ libgirepository1.0-dev \ libpq-dev \ @@ -58,4 +58,5 @@ RUN \ pkg-config \ tzdata \ valac && \ + apt install -y -V -t $(lsb_release --codename --short)-backports ${quiet} golang-1.21 && \ apt clean diff --git a/ci/linux-packages/apt/debian-bullseye/Dockerfile b/ci/linux-packages/apt/debian-bullseye/Dockerfile deleted file mode 100644 index cda653f310..0000000000 --- a/ci/linux-packages/apt/debian-bullseye/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -ARG FROM=debian:bullseye -FROM ${FROM} - -RUN \ - echo "debconf debconf/frontend select Noninteractive" | \ - debconf-set-selections - -RUN \ - echo 'APT::Install-Recommends "false";' > \ - /etc/apt/apt.conf.d/disable-install-recommends - -RUN sed -i'' -e 's/main$/main contrib non-free/g' /etc/apt/sources.list - -ARG DEBUG -RUN \ - quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \ - apt update ${quiet} && \ - apt install -y -V ${quiet} \ - ca-certificates \ - lsb-release \ - wget && \ - wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ - apt install -y -V ${quiet} \ - ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ - rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ - grep " $(lsb_release --codename --short) " /etc/apt/sources.list | \ - sed -e "s/$(lsb_release --codename --short)/$(lsb_release --codename --short)-backports/g" > \ - /etc/apt/sources.list.d/backports.list && \ - apt update && \ - apt install -y -V ${quiet} \ - build-essential \ - ccache \ - cmake \ - debhelper \ - devscripts \ - gobject-introspection \ - libarrow-glib-dev \ - libgirepository1.0-dev \ - libpq-dev \ - libsqlite3-dev \ - ninja-build \ - pkg-config \ - tzdata \ - valac && \ - apt install -y -V -t $(lsb_release --codename --short)-backports ${quiet} \ - golang \ - meson && \ - apt clean diff --git a/ci/linux-packages/apt/ubuntu-jammy/Dockerfile b/ci/linux-packages/apt/ubuntu-jammy/Dockerfile index bc5708e343..d839c12e7c 100644 --- a/ci/linux-packages/apt/ubuntu-jammy/Dockerfile +++ b/ci/linux-packages/apt/ubuntu-jammy/Dockerfile @@ -59,5 +59,5 @@ RUN \ tzdata \ valac && \ apt install -y -V -t $(lsb_release --codename --short)-backports ${quiet} \ - golang-1.20 && \ + golang-1.21 && \ apt clean diff --git a/ci/linux-packages/debian/control b/ci/linux-packages/debian/control index 88e490222f..970933c5d4 100644 --- a/ci/linux-packages/debian/control +++ b/ci/linux-packages/debian/control @@ -23,7 +23,7 @@ Build-Depends: cmake, debhelper-compat (= 12), gobject-introspection, - golang | golang-1.20, + golang | golang-1.21, libarrow-glib-dev, libgirepository1.0-dev, libpq-dev, diff --git a/ci/linux-packages/debian/rules b/ci/linux-packages/debian/rules index ce356e2cdc..2bc2c5e8ae 100755 --- a/ci/linux-packages/debian/rules +++ b/ci/linux-packages/debian/rules @@ -32,7 +32,7 @@ CMAKE_BUILD_TYPE = RelWithDebInfo override_dh_auto_configure: env \ - PATH=/usr/lib/go-1.20/bin:$${PATH} \ + PATH=/usr/lib/go-1.21/bin:$${PATH} \ dh_auto_configure \ --sourcedirectory=c/ \ --builddirectory=c.build \ diff --git a/ci/linux-packages/yum/almalinux-8/Dockerfile b/ci/linux-packages/yum/almalinux-8/Dockerfile index 8768d9ff6c..9f6752126e 100644 --- a/ci/linux-packages/yum/almalinux-8/Dockerfile +++ b/ci/linux-packages/yum/almalinux-8/Dockerfile @@ -30,7 +30,6 @@ RUN \ cmake \ gcc-c++ \ gobject-introspection-devel \ - golang \ libpq-devel \ make \ ninja-build \ @@ -40,5 +39,12 @@ RUN \ rpmdevtools \ sqlite-devel \ tar \ + wget \ vala && \ yum clean ${quiet} all + +ARG GO_VERSION +RUN wget --no-verbose https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \ + rm go${GO_VERSION}.linux-amd64.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" diff --git a/ci/linux-packages/yum/almalinux-9/Dockerfile b/ci/linux-packages/yum/almalinux-9/Dockerfile index 7d1929e459..084393946d 100644 --- a/ci/linux-packages/yum/almalinux-9/Dockerfile +++ b/ci/linux-packages/yum/almalinux-9/Dockerfile @@ -30,7 +30,6 @@ RUN \ cmake \ gcc-c++ \ gobject-introspection-devel \ - golang \ libpq-devel \ make \ ninja-build \ @@ -40,5 +39,13 @@ RUN \ rpmdevtools \ sqlite-devel \ tar \ + wget \ vala && \ dnf clean ${quiet} all + + +ARG GO_VERSION +RUN wget --no-verbose https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \ + rm go${GO_VERSION}.linux-amd64.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" diff --git a/ci/linux-packages/yum/apache-arrow-adbc.spec.in b/ci/linux-packages/yum/apache-arrow-adbc.spec.in index d1ba2d6a93..9d6da18bac 100644 --- a/ci/linux-packages/yum/apache-arrow-adbc.spec.in +++ b/ci/linux-packages/yum/apache-arrow-adbc.spec.in @@ -44,7 +44,6 @@ BuildRequires: arrow-glib-devel BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gobject-introspection-devel -BuildRequires: golang BuildRequires: libpq-devel BuildRequires: ninja-build BuildRequires: pkgconfig diff --git a/ci/scripts/cpp_recipe.sh b/ci/scripts/cpp_recipe.sh index 2d97f94fac..b3cf2f3ce6 100755 --- a/ci/scripts/cpp_recipe.sh +++ b/ci/scripts/cpp_recipe.sh @@ -30,7 +30,7 @@ main() { export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib" - export GODEBUG=cgocheck=2 + export GOEXPERIMENT=cgocheck2 mkdir -p "${build_dir}" pushd "${build_dir}" diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh index dbdae25371..e5600b561d 100755 --- a/ci/scripts/cpp_test.sh +++ b/ci/scripts/cpp_test.sh @@ -71,7 +71,6 @@ main() { export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib" - export GODEBUG=cgocheck=2 test_project "${build_dir}" } diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index 45382a5605..0e2f1f6e3e 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -23,7 +23,7 @@ # - Maven >= 3.3.9 # - JDK >=7 # - gcc >= 4.8 -# - Go >= 1.20 +# - Go >= 1.21 # - Docker # # To reuse build artifacts between runs set ARROW_TMPDIR environment variable to @@ -168,8 +168,7 @@ test_apt() { if [ "${TEST_STAGING:-0}" -gt 0 ]; then verify_type=staging-${verify_type} fi - for target in "debian:bullseye" \ - "debian:bookworm" \ + for target in "debian:bookworm" \ "ubuntu:jammy"; do \ show_info "Verifying ${target}..." if ! docker run \ @@ -254,7 +253,7 @@ install_go() { return 0 fi - local version=1.19.13 + local version=1.21.8 show_info "Installing go version ${version}..." local arch="$(uname -m)" @@ -271,7 +270,7 @@ install_go() { fi local archive="go${version}.${os}-${arch}.tar.gz" - curl -sLO https://dl.google.com/go/$archive + curl -sLO https://go.dev/dl/$archive local prefix=${ARROW_TMPDIR}/go mkdir -p $prefix @@ -413,7 +412,7 @@ test_cpp() { maybe_setup_conda \ --file ci/conda_env_cpp.txt \ compilers \ - go=1.20 || exit 1 + go=1.21 || exit 1 if [ "${USE_CONDA}" -gt 0 ]; then export CMAKE_PREFIX_PATH="${CONDA_BACKUP_CMAKE_PREFIX_PATH}:${CMAKE_PREFIX_PATH}" @@ -564,7 +563,7 @@ test_go() { # apache/arrow-adbc#517: `go build` calls git. Don't assume system # has git; even if it's there, go_build.sh sets DYLD_LIBRARY_PATH # which can interfere with system git. - maybe_setup_conda compilers git go=1.20 || exit 1 + maybe_setup_conda compilers git go=1.21 || exit 1 if [ "${USE_CONDA}" -gt 0 ]; then # The CMake setup forces RPATH to be the Conda prefix diff --git a/docker-compose.yml b/docker-compose.yml index e31c8af0b1..cb6146f3c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,7 @@ services: dockerfile: ci/docker/python-wheel-manylinux.dockerfile args: ARCH: ${ARCH} + GO: ${GO} MANYLINUX: ${MANYLINUX} PYTHON: ${PYTHON} REPO: ${REPO} @@ -102,6 +103,7 @@ services: dockerfile: ci/docker/python-wheel-manylinux.dockerfile args: ARCH: ${ARCH} + GO: ${GO} MANYLINUX: ${MANYLINUX} PYTHON: ${PYTHON} REPO: ${REPO} diff --git a/go/adbc/driver/flightsql/logging.go b/go/adbc/driver/flightsql/logging.go index 6957218b26..4fb12c4112 100644 --- a/go/adbc/driver/flightsql/logging.go +++ b/go/adbc/driver/flightsql/logging.go @@ -20,11 +20,11 @@ package flightsql import ( "context" "io" + "log/slog" "time" "golang.org/x/exp/maps" "golang.org/x/exp/slices" - "golang.org/x/exp/slog" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/go/adbc/driver/internal/driverbase/connection.go b/go/adbc/driver/internal/driverbase/connection.go index 68b0a9bc69..fc1fc0d369 100644 --- a/go/adbc/driver/internal/driverbase/connection.go +++ b/go/adbc/driver/internal/driverbase/connection.go @@ -20,13 +20,13 @@ package driverbase import ( "context" "fmt" + "log/slog" "github.com/apache/arrow-adbc/go/adbc" "github.com/apache/arrow-adbc/go/adbc/driver/internal" "github.com/apache/arrow/go/v16/arrow" "github.com/apache/arrow/go/v16/arrow/array" "github.com/apache/arrow/go/v16/arrow/memory" - "golang.org/x/exp/slog" ) const ( diff --git a/go/adbc/driver/internal/driverbase/database.go b/go/adbc/driver/internal/driverbase/database.go index 9ab00967a5..477c4304b3 100644 --- a/go/adbc/driver/internal/driverbase/database.go +++ b/go/adbc/driver/internal/driverbase/database.go @@ -19,10 +19,10 @@ package driverbase import ( "context" + "log/slog" "github.com/apache/arrow-adbc/go/adbc" "github.com/apache/arrow/go/v16/arrow/memory" - "golang.org/x/exp/slog" ) const ( diff --git a/go/adbc/driver/internal/driverbase/driver_test.go b/go/adbc/driver/internal/driverbase/driver_test.go index f43a049bbe..309c529c1e 100644 --- a/go/adbc/driver/internal/driverbase/driver_test.go +++ b/go/adbc/driver/internal/driverbase/driver_test.go @@ -20,10 +20,9 @@ package driverbase_test import ( "context" "fmt" + "log/slog" "testing" - "golang.org/x/exp/slog" - "github.com/apache/arrow-adbc/go/adbc" "github.com/apache/arrow-adbc/go/adbc/driver/internal" "github.com/apache/arrow-adbc/go/adbc/driver/internal/driverbase" diff --git a/go/adbc/driver/internal/driverbase/logging.go b/go/adbc/driver/internal/driverbase/logging.go index 2660b4a916..795fca6f66 100644 --- a/go/adbc/driver/internal/driverbase/logging.go +++ b/go/adbc/driver/internal/driverbase/logging.go @@ -18,9 +18,8 @@ package driverbase import ( + "log/slog" "os" - - "golang.org/x/exp/slog" ) func nilLogger() *slog.Logger { diff --git a/go/adbc/ext.go b/go/adbc/ext.go index dcfaeaebf9..f82c6d63a4 100644 --- a/go/adbc/ext.go +++ b/go/adbc/ext.go @@ -18,7 +18,7 @@ package adbc import ( - "golang.org/x/exp/slog" + "log/slog" ) // DatabaseLogging is a Database that also supports logging information to an diff --git a/go/adbc/go.mod b/go/adbc/go.mod index 35bdc70817..9e46d7ecdb 100644 --- a/go/adbc/go.mod +++ b/go/adbc/go.mod @@ -17,7 +17,7 @@ module github.com/apache/arrow-adbc/go/adbc -go 1.19 +go 1.21 require ( github.com/apache/arrow/go/v16 v16.0.0-20240307132415-1c9a3122c603 @@ -27,7 +27,7 @@ require ( github.com/snowflakedb/gosnowflake v1.8.0 github.com/stretchr/testify v1.9.0 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a + golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 golang.org/x/sync v0.6.0 golang.org/x/tools v0.19.0 google.golang.org/grpc v1.58.3 @@ -41,7 +41,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0 // indirect github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect - github.com/andybalholm/brotli v1.0.5 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect github.com/apache/arrow/go/v14 v14.0.2 // indirect github.com/apache/thrift v0.17.0 // indirect github.com/aws/aws-sdk-go-v2 v1.25.1 // indirect @@ -68,16 +68,18 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v24.3.7+incompatible // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/asmfmt v1.3.2 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -97,11 +99,12 @@ require ( lukechampine.com/uint128 v1.3.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.22.4 // indirect - modernc.org/mathutil v1.5.0 // indirect - modernc.org/memory v1.5.0 // indirect + modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect + modernc.org/libc v1.45.3 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.7.2 // indirect modernc.org/opt v0.1.3 // indirect - modernc.org/sqlite v1.21.2 // indirect - modernc.org/strutil v1.1.3 // indirect + modernc.org/sqlite v1.29.5 // indirect + modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go/adbc/go.sum b/go/adbc/go.sum index cf74b7baa8..189d225e10 100644 --- a/go/adbc/go.sum +++ b/go/adbc/go.sum @@ -5,16 +5,21 @@ github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTB github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 h1:AifHbc4mg0x9zW52WOpKbsHaDKuRhlI7TVl47thgQ70= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0/go.mod h1:T5RfihdXtBDxt1Ch2wobif3TvzTdumDy29kahv6AV9A= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0 h1:IfFdxTUDiV58iZqPKgyWiz4X4fCxZeQ1pTQPImLYXpY= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.0/go.mod h1:SUZc9YRRHfx2+FAQKNDGrssXehqLpxmwRv2mC/5ntj4= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvKIROun94nF7v2cua9qP+thov/7M50KEoeSU= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/apache/arrow/go/v14 v14.0.2 h1:N8OkaJEOfI3mEZt07BIkvo4sC6XDbL+48MBPWO5IONw= github.com/apache/arrow/go/v14 v14.0.2/go.mod h1:u3fgh3EdgN/YQ8cVQRguVW3R+seMybFg8QBQ5LU+eBY= github.com/apache/arrow/go/v16 v16.0.0-20240307132415-1c9a3122c603 h1:UOXjIpzPxFAsxrtqUa+e8yuVdhMklFi+Uyo6oB+sDK4= @@ -26,9 +31,11 @@ github.com/aws/aws-sdk-go-v2 v1.25.1/go.mod h1:Evoc5AsmtveRt1komDwIsjHFyrP5tDuF1 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 h1:gTK2uhtAPtFcdRRJilZPx8uJLL2J85xK11nKtWL0wfU= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1/go.mod h1:sxpLb+nZk7tIfCWChfd+h4QwHNUR57d8hA1cleTkjJo= github.com/aws/aws-sdk-go-v2/config v1.27.2 h1:XnMKB9JRjfnxg9ZkUic4MiapnWJISWRo8HVM+7nx9qQ= +github.com/aws/aws-sdk-go-v2/config v1.27.2/go.mod h1:z/XIktFoVIKNEqX/811vx4eHetrC3tAkgJKL1ZY/KM4= github.com/aws/aws-sdk-go-v2/credentials v1.17.2 h1:tCZXWtH0HiIEZ50NJ7/QEaXmuzEd36L+2JUiZkp2nsc= github.com/aws/aws-sdk-go-v2/credentials v1.17.2/go.mod h1:7Zo+D6q4auSIo3p4EItuTKTk7J+RqjASISZqLvmUgpc= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.1 h1:lk1ZZFbdb24qpOwVC1AwYNrswUjAxeyey6kFBVANudQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.1/go.mod h1:/xJ6x1NehNGCX4tvGzzj2bq5TBOT/Yxq+qbL9Jpx2Vk= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.4 h1:yuhSpqtahkrC8kRCU5v4gEaTDy/ccTIPIkufIRF7YTk= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.4/go.mod h1:q3SxgP2WD9YRLCybtyse8EgO3vKKWVmxlTmBNeRXPyk= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.1 h1:evvi7FbTAoFxdP/mixmP7LIYzQWAmzBcwNB/es9XPNc= @@ -36,6 +43,7 @@ github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.1/go.mod h1:rH61DT6FDdi github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.1 h1:RAnaIrbxPtlXNVI/OIlh1sidTQ3e1qM6LRjs7N0bE0I= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.1/go.mod h1:nbgAGkH5lk0RZRMh6A4K/oG6Xj11eC/1CyDow+DUAFI= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.1 h1:rtYJd3w6IWCTVS8vmMaiXjW198noh2PBm5CiXyJea9o= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.1/go.mod h1:zvXu+CTlib30LUy4LTNFc6HTZ/K6zCae5YIHTdX9wIo= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= @@ -49,8 +57,11 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.1/go.mod h1:s5rqdn7 github.com/aws/aws-sdk-go-v2/service/s3 v1.50.3 h1:Cv/HH7sLzEdJMYQi4MCNHxZeyubQNOOIdVc0VU0lo3Q= github.com/aws/aws-sdk-go-v2/service/s3 v1.50.3/go.mod h1:lTW7O4iMAnO2o7H3XJTvqaWFZCH6zIPs+eP7RdG/yp0= github.com/aws/aws-sdk-go-v2/service/sso v1.19.2 h1:pnj8llQoBAHD4UmbM8UM5GdfycFJKMhgPSeaOyRaZ34= +github.com/aws/aws-sdk-go-v2/service/sso v1.19.2/go.mod h1:x6/tCd1o/AOKQR+iYnjrzhJxD+w0xRN34asGPaSV7ew= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.22.2 h1:L4yhKxW6HbTSQ08OsvPJuaspaLE40qMgprgXUNFUiMg= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.22.2/go.mod h1:lZB123q0SVQ3dfIbEOcGzhQHrwVBcHVReNS9tm20oU4= github.com/aws/aws-sdk-go-v2/service/sts v1.27.2 h1:Dr+7r/p20XpN+1U5tVNZfA2bLq0kQ9IjVBM0iAyMMLg= +github.com/aws/aws-sdk-go-v2/service/sts v1.27.2/go.mod h1:ozhhG9/NB5c9jcmhGq6tX9dpp21LYdmRWRQVppASim4= github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= @@ -61,6 +72,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= @@ -74,6 +86,7 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -81,11 +94,15 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/flatbuffers v24.3.7+incompatible h1:BxGUkIQnOciBu33bd5BdvqY8Qvo0O/GR4SPhh7x9Ed0= github.com/google/flatbuffers v24.3.7+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -99,12 +116,17 @@ github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ib github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= @@ -113,6 +135,8 @@ github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8D github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -124,6 +148,7 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qq github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/snowflakedb/gosnowflake v1.8.0 h1:4bQj8eAYGMkou/nICiIEb9jSbBLDDp5cB6JaKx9WwiA= @@ -137,6 +162,7 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -145,6 +171,8 @@ golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 h1:6R2FC06FonbXQ8pK11/PDFY6N6LWlf9KlzibaCapmqc= +golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -170,6 +198,7 @@ golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= +gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= @@ -179,8 +208,10 @@ google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHh gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -191,20 +222,36 @@ modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= +modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= +modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8= +modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= +modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/libc v1.22.4 h1:wymSbZb0AlrjdAVX3cjreCHTPCpPARbQXNz6BHPzdwQ= modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= +modernc.org/libc v1.45.3 h1:lI7aT+kT0pg15LRTWTERIxdqJQnqJhKZmOV9gCli8YA= +modernc.org/libc v1.45.3/go.mod h1:YkRHLoN4L70OdO1cVmM83KZhRbRvsc3XogfVzbTXBwE= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sqlite v1.21.2 h1:ixuUG0QS413Vfzyx6FWx6PYTmHaOegTY+hjzhn7L+a0= modernc.org/sqlite v1.21.2/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0= +modernc.org/sqlite v1.29.5 h1:8l/SQKAjDtZFo9lkJLdk8g9JEOeYRG4/ghStDCCTiTE= +modernc.org/sqlite v1.29.5/go.mod h1:S02dvcmm7TnTRvGhv8IGYyLnIt7AS2KPaB1F/71p75U= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= +modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws= +modernc.org/tcl v1.15.1/go.mod h1:aEjeGJX2gz1oWKOLDVZ2tnEWLUrIn8H+GFu+akoDhqs= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= +modernc.org/z v1.7.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ= diff --git a/go/adbc/pkg/_tmpl/driver.go.tmpl b/go/adbc/pkg/_tmpl/driver.go.tmpl index 409b3ca566..21a9e09193 100644 --- a/go/adbc/pkg/_tmpl/driver.go.tmpl +++ b/go/adbc/pkg/_tmpl/driver.go.tmpl @@ -50,6 +50,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "runtime" "runtime/cgo" @@ -62,15 +63,13 @@ import ( "github.com/apache/arrow/go/v16/arrow/cdata" "github.com/apache/arrow/go/v16/arrow/memory" "github.com/apache/arrow/go/v16/arrow/memory/mallocator" - "golang.org/x/exp/slog" ) // Must use malloc() to respect CGO rules var drv = {{.Driver}}(mallocator.NewMallocator()) // Flag set if any method panic()ed - afterwards all calls to driver will fail // since internal state of driver is unknown -// (Can't use atomic.Bool since that's Go 1.19) -var globalPoison int32 = 0 +var globalPoison atomic.Bool const errPrefix = "[{{.Prefix}}] " const logLevelEnvVar = "ADBC_DRIVER_{{.PrefixUpper}}_LOG_LEVEL" @@ -155,7 +154,7 @@ func errToAdbcErr(adbcerr *C.struct_AdbcError, err error) adbc.Status { // We panicked; make all API functions error and dump stack traces func poison(err *C.struct_AdbcError, fname string, e interface{}) C.AdbcStatusCode { - if atomic.SwapInt32(&globalPoison, 1) == 0 { + if !globalPoison.Swap(true) { // Only print stack traces on the first occurrence buf := make([]byte, 1<<20) length := runtime.Stack(buf, true) @@ -262,7 +261,7 @@ func (c *cancellableContext) cancelContext() { } func checkDBAlloc(db *C.struct_AdbcDatabase, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -564,7 +563,7 @@ func {{.Prefix}}DatabaseNew(db *C.struct_AdbcDatabase, err *C.struct_AdbcError) code = poison(err, "AdbcDatabaseNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcDatabaseNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -709,7 +708,7 @@ type cConn struct { } func checkConnAlloc(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -840,7 +839,7 @@ func {{.Prefix}}ConnectionNew(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcE code = poison(err, "AdbcConnectionNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcConnectionNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1285,7 +1284,7 @@ type cStmt struct { } func checkStmtAlloc(stmt *C.struct_AdbcStatement, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -1415,7 +1414,7 @@ func {{.Prefix}}StatementNew(cnxn *C.struct_AdbcConnection, stmt *C.struct_AdbcS code = poison(err, "AdbcStatementNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1446,7 +1445,7 @@ func {{.Prefix}}StatementRelease(stmt *C.struct_AdbcStatement, err *C.struct_Adb code = poison(err, "AdbcStatementRelease", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementRelease: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } diff --git a/go/adbc/pkg/doc.go b/go/adbc/pkg/doc.go index 8aa95d75ae..7dfc136fc4 100644 --- a/go/adbc/pkg/doc.go +++ b/go/adbc/pkg/doc.go @@ -30,3 +30,4 @@ package pkg //go:generate go run ./gen -prefix "FlightSQL" -driver ../driver/flightsql -o flightsql //go:generate go run ./gen -prefix "Snowflake" -driver ../driver/snowflake -o snowflake +//go:generate go run ./gen -prefix "PanicDummy" -driver ../driver/panicdummy -o panicdummy diff --git a/go/adbc/pkg/flightsql/driver.go b/go/adbc/pkg/flightsql/driver.go index dc1927a179..86b7c78ed3 100644 --- a/go/adbc/pkg/flightsql/driver.go +++ b/go/adbc/pkg/flightsql/driver.go @@ -52,6 +52,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "runtime" "runtime/cgo" @@ -65,7 +66,6 @@ import ( "github.com/apache/arrow/go/v16/arrow/cdata" "github.com/apache/arrow/go/v16/arrow/memory" "github.com/apache/arrow/go/v16/arrow/memory/mallocator" - "golang.org/x/exp/slog" ) // Must use malloc() to respect CGO rules @@ -73,8 +73,7 @@ var drv = flightsql.NewDriver(mallocator.NewMallocator()) // Flag set if any method panic()ed - afterwards all calls to driver will fail // since internal state of driver is unknown -// (Can't use atomic.Bool since that's Go 1.19) -var globalPoison int32 = 0 +var globalPoison atomic.Bool const errPrefix = "[FlightSQL] " const logLevelEnvVar = "ADBC_DRIVER_FLIGHTSQL_LOG_LEVEL" @@ -159,7 +158,7 @@ func errToAdbcErr(adbcerr *C.struct_AdbcError, err error) adbc.Status { // We panicked; make all API functions error and dump stack traces func poison(err *C.struct_AdbcError, fname string, e interface{}) C.AdbcStatusCode { - if atomic.SwapInt32(&globalPoison, 1) == 0 { + if !globalPoison.Swap(true) { // Only print stack traces on the first occurrence buf := make([]byte, 1<<20) length := runtime.Stack(buf, true) @@ -265,7 +264,7 @@ func (c *cancellableContext) cancelContext() { } func checkDBAlloc(db *C.struct_AdbcDatabase, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -567,7 +566,7 @@ func FlightSQLDatabaseNew(db *C.struct_AdbcDatabase, err *C.struct_AdbcError) (c code = poison(err, "AdbcDatabaseNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcDatabaseNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -712,7 +711,7 @@ type cConn struct { } func checkConnAlloc(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -843,7 +842,7 @@ func FlightSQLConnectionNew(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcErr code = poison(err, "AdbcConnectionNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcConnectionNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1288,7 +1287,7 @@ type cStmt struct { } func checkStmtAlloc(stmt *C.struct_AdbcStatement, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -1418,7 +1417,7 @@ func FlightSQLStatementNew(cnxn *C.struct_AdbcConnection, stmt *C.struct_AdbcSta code = poison(err, "AdbcStatementNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1449,7 +1448,7 @@ func FlightSQLStatementRelease(stmt *C.struct_AdbcStatement, err *C.struct_AdbcE code = poison(err, "AdbcStatementRelease", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementRelease: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } diff --git a/go/adbc/pkg/panicdummy/driver.go b/go/adbc/pkg/panicdummy/driver.go index 7b13a0612e..6d22e91467 100644 --- a/go/adbc/pkg/panicdummy/driver.go +++ b/go/adbc/pkg/panicdummy/driver.go @@ -52,6 +52,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "runtime" "runtime/cgo" @@ -65,7 +66,6 @@ import ( "github.com/apache/arrow/go/v16/arrow/cdata" "github.com/apache/arrow/go/v16/arrow/memory" "github.com/apache/arrow/go/v16/arrow/memory/mallocator" - "golang.org/x/exp/slog" ) // Must use malloc() to respect CGO rules @@ -73,8 +73,7 @@ var drv = panicdummy.NewDriver(mallocator.NewMallocator()) // Flag set if any method panic()ed - afterwards all calls to driver will fail // since internal state of driver is unknown -// (Can't use atomic.Bool since that's Go 1.19) -var globalPoison int32 = 0 +var globalPoison atomic.Bool const errPrefix = "[PanicDummy] " const logLevelEnvVar = "ADBC_DRIVER_PANICDUMMY_LOG_LEVEL" @@ -159,7 +158,7 @@ func errToAdbcErr(adbcerr *C.struct_AdbcError, err error) adbc.Status { // We panicked; make all API functions error and dump stack traces func poison(err *C.struct_AdbcError, fname string, e interface{}) C.AdbcStatusCode { - if atomic.SwapInt32(&globalPoison, 1) == 0 { + if !globalPoison.Swap(true) { // Only print stack traces on the first occurrence buf := make([]byte, 1<<20) length := runtime.Stack(buf, true) @@ -265,7 +264,7 @@ func (c *cancellableContext) cancelContext() { } func checkDBAlloc(db *C.struct_AdbcDatabase, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -567,7 +566,7 @@ func PanicDummyDatabaseNew(db *C.struct_AdbcDatabase, err *C.struct_AdbcError) ( code = poison(err, "AdbcDatabaseNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcDatabaseNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -594,11 +593,15 @@ func PanicDummyDatabaseRelease(db *C.struct_AdbcDatabase, err *C.struct_AdbcErro h := (*(*cgo.Handle)(db.private_data)) cdb := h.Value().(*cDatabase) - cdb.db.Close() - cdb.db = nil + if cdb.db != nil { + cdb.db.Close() + cdb.db = nil + } cdb.opts = nil - C.free(unsafe.Pointer(db.private_data)) - db.private_data = nil + if db.private_data != nil { + C.free(unsafe.Pointer(db.private_data)) + db.private_data = nil + } h.Delete() // manually trigger GC for two reasons: // 1. ASAN expects the release callback to be called before @@ -708,7 +711,7 @@ type cConn struct { } func checkConnAlloc(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -839,7 +842,7 @@ func PanicDummyConnectionNew(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcEr code = poison(err, "AdbcConnectionNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcConnectionNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1284,7 +1287,7 @@ type cStmt struct { } func checkStmtAlloc(stmt *C.struct_AdbcStatement, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -1414,7 +1417,7 @@ func PanicDummyStatementNew(cnxn *C.struct_AdbcConnection, stmt *C.struct_AdbcSt code = poison(err, "AdbcStatementNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1445,7 +1448,7 @@ func PanicDummyStatementRelease(stmt *C.struct_AdbcStatement, err *C.struct_Adbc code = poison(err, "AdbcStatementRelease", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementRelease: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } diff --git a/go/adbc/pkg/snowflake/driver.go b/go/adbc/pkg/snowflake/driver.go index e67fc79a98..c894de6997 100644 --- a/go/adbc/pkg/snowflake/driver.go +++ b/go/adbc/pkg/snowflake/driver.go @@ -52,6 +52,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "runtime" "runtime/cgo" @@ -65,7 +66,6 @@ import ( "github.com/apache/arrow/go/v16/arrow/cdata" "github.com/apache/arrow/go/v16/arrow/memory" "github.com/apache/arrow/go/v16/arrow/memory/mallocator" - "golang.org/x/exp/slog" ) // Must use malloc() to respect CGO rules @@ -73,8 +73,7 @@ var drv = snowflake.NewDriver(mallocator.NewMallocator()) // Flag set if any method panic()ed - afterwards all calls to driver will fail // since internal state of driver is unknown -// (Can't use atomic.Bool since that's Go 1.19) -var globalPoison int32 = 0 +var globalPoison atomic.Bool const errPrefix = "[Snowflake] " const logLevelEnvVar = "ADBC_DRIVER_SNOWFLAKE_LOG_LEVEL" @@ -159,7 +158,7 @@ func errToAdbcErr(adbcerr *C.struct_AdbcError, err error) adbc.Status { // We panicked; make all API functions error and dump stack traces func poison(err *C.struct_AdbcError, fname string, e interface{}) C.AdbcStatusCode { - if atomic.SwapInt32(&globalPoison, 1) == 0 { + if !globalPoison.Swap(true) { // Only print stack traces on the first occurrence buf := make([]byte, 1<<20) length := runtime.Stack(buf, true) @@ -265,7 +264,7 @@ func (c *cancellableContext) cancelContext() { } func checkDBAlloc(db *C.struct_AdbcDatabase, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -567,7 +566,7 @@ func SnowflakeDatabaseNew(db *C.struct_AdbcDatabase, err *C.struct_AdbcError) (c code = poison(err, "AdbcDatabaseNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcDatabaseNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -712,7 +711,7 @@ type cConn struct { } func checkConnAlloc(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -843,7 +842,7 @@ func SnowflakeConnectionNew(cnxn *C.struct_AdbcConnection, err *C.struct_AdbcErr code = poison(err, "AdbcConnectionNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcConnectionNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1288,7 +1287,7 @@ type cStmt struct { } func checkStmtAlloc(stmt *C.struct_AdbcStatement, err *C.struct_AdbcError, fname string) bool { - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "%s: Go panicked, driver is in unknown state", fname) return false } @@ -1418,7 +1417,7 @@ func SnowflakeStatementNew(cnxn *C.struct_AdbcConnection, stmt *C.struct_AdbcSta code = poison(err, "AdbcStatementNew", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementNew: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } @@ -1449,7 +1448,7 @@ func SnowflakeStatementRelease(stmt *C.struct_AdbcStatement, err *C.struct_AdbcE code = poison(err, "AdbcStatementRelease", e) } }() - if atomic.LoadInt32(&globalPoison) != 0 { + if globalPoison.Load() { setErr(err, "AdbcStatementRelease: Go panicked, driver is in unknown state") return C.ADBC_STATUS_INTERNAL } diff --git a/go/adbc/sqldriver/driver.go b/go/adbc/sqldriver/driver.go index 49bf5191ab..a1725a9a9c 100644 --- a/go/adbc/sqldriver/driver.go +++ b/go/adbc/sqldriver/driver.go @@ -468,8 +468,8 @@ func arrFromVal(val any) arrow.Array { case string: dt = arrow.BinaryTypes.String buffers[1] = memory.NewBufferBytes(arrow.Int32Traits.CastToBytes([]int32{0, int32(len(v))})) - var buf = *(*[]byte)(unsafe.Pointer(&v)) - (*reflect.SliceHeader)(unsafe.Pointer(&buf)).Cap = len(v) + + buf := unsafe.Slice(unsafe.StringData(v), len(v)) buffers = append(buffers, memory.NewBufferBytes(buf)) default: panic(fmt.Sprintf("unsupported type %T", val)) diff --git a/r/adbcflightsql/DESCRIPTION b/r/adbcflightsql/DESCRIPTION index 455fec1cd9..f66ac6befd 100644 --- a/r/adbcflightsql/DESCRIPTION +++ b/r/adbcflightsql/DESCRIPTION @@ -19,7 +19,7 @@ RoxygenNote: 7.2.3 Suggests: nanoarrow, testthat (>= 3.0.0) -SystemRequirements: GNU make, Go (>= 1.19.13) +SystemRequirements: GNU make, Go (>= 1.21) Config/testthat/edition: 3 Config/build/bootstrap: TRUE URL: https://github.com/apache/arrow-adbc, https://arrow.apache.org/adbc/current/r/adbcflightsql/ diff --git a/r/adbcflightsql/tools/download-go.R b/r/adbcflightsql/tools/download-go.R index 4b49097305..5f178f4c80 100644 --- a/r/adbcflightsql/tools/download-go.R +++ b/r/adbcflightsql/tools/download-go.R @@ -17,7 +17,7 @@ tmp_dir <- "src/go/tmp" -go_version <- Sys.getenv("R_ADBC_GO_VERSION_DOWNLOAD", "1.19.13") +go_version <- Sys.getenv("R_ADBC_GO_VERSION_DOWNLOAD", "1.21.8") go_platform <- tolower(Sys.info()[["sysname"]]) if (!(go_platform %in% c("darwin", "linux", "windows"))) { diff --git a/r/adbcsnowflake/DESCRIPTION b/r/adbcsnowflake/DESCRIPTION index 731c30a049..61d1c7c804 100644 --- a/r/adbcsnowflake/DESCRIPTION +++ b/r/adbcsnowflake/DESCRIPTION @@ -20,7 +20,7 @@ Suggests: nanoarrow, openssl, testthat (>= 3.0.0) -SystemRequirements: GNU make, Go (>= 1.19.13) +SystemRequirements: GNU make, Go (>= 1.21) Config/testthat/edition: 3 Config/build/bootstrap: TRUE URL: https://github.com/apache/arrow-adbc, https://arrow.apache.org/adbc/current/r/adbcsnowflake/