diff --git a/.dockerignore b/.dockerignore index 5d6d171fdecbf..3791cca95e3fe 100644 --- a/.dockerignore +++ b/.dockerignore @@ -61,3 +61,5 @@ !rust/datafusion/Cargo.toml !rust/datafusion/benches !rust/integration-testing/Cargo.toml +!go/go.mod +!go/go.sum \ No newline at end of file diff --git a/.env b/.env index f00f1fd7d0985..d754cbfca3c55 100644 --- a/.env +++ b/.env @@ -59,6 +59,7 @@ DASK=latest DOTNET=6.0 GCC_VERSION="" GO=1.16 +STATICCHECK=v0.2.2 HDFS=3.2.1 JDK=8 KARTOTHEK=latest diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cbbe067007d75..f3fa866c86d79 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -50,9 +50,15 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest env: GO: ${{ matrix.go }} + STATICCHECK: ${{ matrix.staticcheck }} steps: - name: Checkout Arrow uses: actions/checkout@v3 @@ -80,9 +86,15 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest env: GO: ${{ matrix.go }} + STATICCHECK: ${{ matrix.staticcheck }} steps: - name: Checkout Arrow uses: actions/checkout@v3 @@ -111,9 +123,15 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest env: GO: ${{ matrix.go }} + STATICCHECK: ${{ matrix.staticcheck }} steps: - name: Checkout Arrow uses: actions/checkout@v3 @@ -140,19 +158,26 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] - steps: - - name: Install go - uses: actions/setup-go@v1 - with: - go-version: ${{ matrix.go }} + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest + steps: - name: Checkout Arrow uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive + - name: Install go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + cache: true + cache-dependency-path: go/go.sum - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 + run: go install honnef.co/go/tools/cmd/staticcheck@${{ matrix.staticcheck }} - name: Build shell: bash run: ci/scripts/go_build.sh $(pwd) @@ -168,19 +193,26 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] - steps: - - name: Install go - uses: actions/setup-go@v1 - with: - go-version: ${{ matrix.go }} + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest + steps: - name: Checkout Arrow uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive + - name: Install go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + cache: true + cache-dependency-path: go/go.sum - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 + run: go install honnef.co/go/tools/cmd/staticcheck@${{ matrix.staticcheck }} - name: Build shell: bash run: ci/scripts/go_build.sh $(pwd) @@ -196,24 +228,31 @@ jobs: strategy: fail-fast: false matrix: - go: [1.16] + go: [1.16, 1.18] + include: + - go: 1.16 + staticcheck: v0.2.2 + - go: 1.18 + staticcheck: latest env: ARROW_GO_TESTCGO: "1" - steps: - - name: Install go - uses: actions/setup-go@v1 - with: - go-version: ${{ matrix.go }} + steps: - name: Checkout Arrow uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive + - name: Install go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + cache: true + cache-dependency-path: go/go.sum - name: Brew Install Arrow shell: bash run: brew install apache-arrow - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 + run: go install honnef.co/go/tools/cmd/staticcheck@${{ matrix.staticcheck }} - name: Build shell: bash run: ci/scripts/go_build.sh $(pwd) @@ -264,11 +303,13 @@ jobs: echo "CGO_LDFLAGS=-g -O2 -L$(cygpath --windows ${MINGW_PREFIX}/lib) -L$(cygpath --windows ${MINGW_PREFIX}/bin)" >> $GITHUB_ENV echo "MINGW_PREFIX=$(cygpath --windows ${MINGW_PREFIX})" >> $GITHUB_ENV - name: Install go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' + cache: true + cache-dependency-path: go/go.sum - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 + run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Build shell: bash run: ci/scripts/go_build.sh $(pwd) diff --git a/ci/docker/debian-10-go.dockerfile b/ci/docker/debian-10-go.dockerfile index f0c0522081d1c..dfe81f5a73ced 100644 --- a/ci/docker/debian-10-go.dockerfile +++ b/ci/docker/debian-10-go.dockerfile @@ -16,12 +16,15 @@ # under the License. ARG arch=amd64 -ARG go=1.15 +ARG go=1.16 +ARG staticcheck=v0.2.2 FROM ${arch}/golang:${go}-buster -RUN GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 +# FROM collects all the args, get back the staticcheck version arg +ARG staticcheck -# TODO(kszucs): -# 1. add the files required to install the dependencies to .dockerignore -# 2. copy these files to their appropriate path -# 3. download and compile the dependencies +RUN GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@${staticcheck} + +# Copy the go.mod and go.sum over and pre-download all the dependencies +COPY go/ /arrow/go +RUN cd /arrow/go && go mod download diff --git a/ci/docker/debian-11-go.dockerfile b/ci/docker/debian-11-go.dockerfile index 33f523e36aa00..32d7b3af39018 100644 --- a/ci/docker/debian-11-go.dockerfile +++ b/ci/docker/debian-11-go.dockerfile @@ -17,11 +17,13 @@ ARG arch=amd64 ARG go=1.16 +ARG staticcheck=v0.2.2 FROM ${arch}/golang:${go}-bullseye -RUN GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 +# FROM collects all the args, get back the staticcheck version arg +ARG staticcheck +RUN GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@${staticcheck} -# TODO(kszucs): -# 1. add the files required to install the dependencies to .dockerignore -# 2. copy these files to their appropriate path -# 3. download and compile the dependencies +# Copy the go.mod and go.sum over and pre-download all the dependencies +COPY go/ /arrow/go +RUN cd /arrow/go && go mod download diff --git a/ci/scripts/go_build.sh b/ci/scripts/go_build.sh index 20879cc0e704e..43f348b153814 100755 --- a/ci/scripts/go_build.sh +++ b/ci/scripts/go_build.sh @@ -36,17 +36,15 @@ if [[ -n "${ARROW_GO_TESTCGO}" ]]; then go clean -cache go clean -testcache fi - TAGS="-tags assert,test,ccalloc" + TAGS="-tags assert,test,ccalloc" fi -go get -d -t -v ./... go install $TAGS -v ./... popd pushd ${source_dir}/parquet -go get -d -t -v ./... go install -v ./... popd diff --git a/ci/scripts/go_test.sh b/ci/scripts/go_test.sh index 760aa149aa91b..0c07e0fc6bf3e 100755 --- a/ci/scripts/go_test.sh +++ b/ci/scripts/go_test.sh @@ -19,10 +19,16 @@ set -ex +ver=`go env GOVERSION` + source_dir=${1}/go -# when we upgrade to at least go1.18, we can add the new -asan option here testargs="-race" +if [[ "${ver#go}" =~ ^1\.1[8-9] ]] && [ "$(go env GOOS)" != "darwin" ]; then + # asan not supported on darwin/amd64 + testargs="-asan" +fi + case "$(uname)" in MINGW*) # -asan and -race don't work on windows currently @@ -45,9 +51,9 @@ fi pushd ${source_dir}/arrow TAGS="assert,test" -if [[ -n "${ARROW_GO_TESTCGO}" ]]; then +if [[ -n "${ARROW_GO_TESTCGO}" ]]; then if [[ "${MSYSTEM}" = "MINGW64" ]]; then - export PATH=${MINGW_PREFIX}/bin:$PATH + export PATH=${MINGW_PREFIX}/bin:$PATH fi TAGS="${TAGS},ccalloc" fi @@ -57,9 +63,7 @@ fi # tag in order to run its tests so that the testing functions implemented # in .c files don't get included in non-test builds. -for d in $(go list ./... | grep -v vendor); do - go test $testargs -tags $TAGS $d -done +go test $testargs -tags $TAGS ./... popd @@ -67,8 +71,6 @@ export PARQUET_TEST_DATA=${1}/cpp/submodules/parquet-testing/data pushd ${source_dir}/parquet -for d in $(go list ./... | grep -v vendor); do - go test $testargs -tags assert $d -done +go test $testargs -tags assert ./... popd diff --git a/docker-compose.yml b/docker-compose.yml index ab15f1c59a37f..903db17b5b76b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1423,6 +1423,7 @@ services: args: arch: ${ARCH} go: ${GO} + staticcheck: ${STATICCHECK} shm_size: *shm-size volumes: *debian-volumes command: &go-command > diff --git a/go/arrow/flight/internal/flight/FlightSql.pb.go b/go/arrow/flight/internal/flight/FlightSql.pb.go index ca38190efbfe4..126d8539cf4c8 100644 --- a/go/arrow/flight/internal/flight/FlightSql.pb.go +++ b/go/arrow/flight/internal/flight/FlightSql.pb.go @@ -1,4 +1,3 @@ -// // 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 @@ -6,9 +5,9 @@ // 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. @@ -24,7 +23,7 @@ package flight import ( - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + descriptor "google.golang.org/protobuf/types/descriptorpb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" diff --git a/go/go.mod b/go/go.mod index 18a1c9abfa773..95a5538d0a5f9 100644 --- a/go/go.mod +++ b/go/go.mod @@ -24,7 +24,6 @@ require ( github.com/apache/thrift v0.16.0 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 github.com/goccy/go-json v0.9.10 - github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.4 github.com/google/flatbuffers v2.0.6+incompatible github.com/klauspost/asmfmt v1.3.2