Skip to content

Commit 0247a26

Browse files
authored
SNOW-1937440 Drop support for Go 1.21, add support for 1.24 (#1308)
1 parent 40c6c21 commit 0247a26

12 files changed

+47
-63
lines changed

.github/workflows/build-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
fail-fast: false
4949
matrix:
5050
cloud: [ 'AWS', 'AZURE', 'GCP' ]
51-
go: [ '1.21', '1.22', '1.23' ]
51+
go: [ '1.22', '1.23', '1.24' ]
5252
name: ${{ matrix.cloud }} Go ${{ matrix.go }} on Ubuntu
5353
steps:
5454
- uses: actions/checkout@v4
@@ -79,7 +79,7 @@ jobs:
7979
fail-fast: false
8080
matrix:
8181
cloud: [ 'AWS', 'AZURE', 'GCP' ]
82-
go: [ '1.21', '1.22', '1.23' ]
82+
go: [ '1.22', '1.23', '1.24' ]
8383
name: ${{ matrix.cloud }} Go ${{ matrix.go }} on Mac
8484
steps:
8585
- uses: actions/checkout@v4
@@ -109,7 +109,7 @@ jobs:
109109
fail-fast: false
110110
matrix:
111111
cloud: [ 'AWS', 'AZURE', 'GCP' ]
112-
go: [ '1.21', '1.22', '1.23' ]
112+
go: [ '1.22', '1.23', '1.24' ]
113113
name: ${{ matrix.cloud }} Go ${{ matrix.go }} on Windows
114114
steps:
115115
- uses: actions/checkout@v4

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ timestamps {
1414
string(name: 'branch', value: 'main'),
1515
string(name: 'client_git_commit', value: scmInfo.GIT_COMMIT),
1616
string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH),
17-
string(name: 'TARGET_DOCKER_TEST_IMAGE', value: 'go-centos7-go1.21'),
17+
string(name: 'TARGET_DOCKER_TEST_IMAGE', value: 'go-chainguard-go1_24'),
1818
string(name: 'parent_job', value: env.JOB_NAME),
1919
string(name: 'parent_build_number', value: env.BUILD_NUMBER)
2020
]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The following software packages are required to use the Go Snowflake Driver.
2525

2626
## Go
2727

28-
The latest driver requires the [Go language](https://golang.org/) 1.20 or higher. The supported operating systems are Linux, Mac OS, and Windows, but you may run the driver on other platforms if the Go language works correctly on those platforms.
28+
The latest driver requires the [Go language](https://golang.org/) 1.22 or higher. The supported operating systems are Linux, Mac OS, and Windows, but you may run the driver on other platforms if the Go language works correctly on those platforms.
2929

3030

3131
# Installation

ci/_init.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env -e
22

33
export PLATFORM=$(echo $(uname) | tr '[:upper:]' '[:lower:]')
44
# Use the internal Docker Registry
@@ -10,6 +10,6 @@ export DRIVER_NAME=go
1010

1111
TEST_IMAGE_VERSION=1
1212
declare -A TEST_IMAGE_NAMES=(
13-
[$DRIVER_NAME-centos7-go1.21]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-go1.21-test:$TEST_IMAGE_VERSION
13+
[$DRIVER_NAME-chainguard-go1_24]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-chainguard-go1.24-test:$TEST_IMAGE_VERSION
1414
)
1515
export TEST_IMAGE_NAMES

ci/image/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM artifactory.int.snowflakecomputing.com/development-chainguard-virtual/snowflake.com/go:1.24.0-dev
2+
3+
USER root
4+
5+
RUN apk update && apk add python3 python3-dev jq aws-cli gosu py3-pip
6+
RUN python3 -m ensurepip
7+
RUN pip install -U snowflake-connector-python
8+
9+
# workspace
10+
RUN mkdir -p /home/user && \
11+
chmod 777 /home/user
12+
WORKDIR /mnt/host
13+
14+
# entry point
15+
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
16+
RUN chmod +x /usr/local/bin/entrypoint.sh
17+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

ci/image/Dockerfile.go-centos7-go1.21-test

-43
This file was deleted.

ci/image/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env bash -e
22
#
33
# Build Docker images
44
#
@@ -9,7 +9,7 @@ source $THIS_DIR/../_init.sh
99
for name in "${!TEST_IMAGE_NAMES[@]}"; do
1010
docker build \
1111
--platform linux/amd64 \
12-
--file $THIS_DIR/Dockerfile.$name-test \
12+
--file $THIS_DIR/Dockerfile \
1313
--label snowflake \
1414
--label $DRIVER_NAME \
1515
--tag ${TEST_IMAGE_NAMES[$name]} .

ci/image/update.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env bash -e
22
#
33
# Build Docker images
44
#

converter_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -2480,3 +2480,18 @@ func TestIsArrayOfStructs(t *testing.T) {
24802480
})
24812481
}
24822482
}
2483+
2484+
func TestSqlNull(t *testing.T) {
2485+
runDBTest(t, func(dbt *DBTest) {
2486+
rows := dbt.mustQuery("SELECT 1, NULL UNION SELECT 2, 'test' ORDER BY 1")
2487+
defer rows.Close()
2488+
var rowID int
2489+
var nullStr sql.Null[string]
2490+
assertTrueF(t, rows.Next())
2491+
assertNilF(t, rows.Scan(&rowID, &nullStr))
2492+
assertEqualE(t, nullStr, sql.Null[string]{Valid: false})
2493+
assertTrueF(t, rows.Next())
2494+
assertNilF(t, rows.Scan(&rowID, &nullStr))
2495+
assertEqualE(t, nullStr, sql.Null[string]{Valid: true, V: "test"})
2496+
})
2497+
}

driver_test.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package gosnowflake
44

55
import (
6+
"cmp"
67
"context"
78
"crypto/rsa"
89
"database/sql"
@@ -52,10 +53,7 @@ const (
5253
func init() {
5354
// get environment variables
5455
env := func(key, defaultValue string) string {
55-
if value := os.Getenv(key); value != "" {
56-
return value
57-
}
58-
return defaultValue
56+
return cmp.Or(os.Getenv(key), defaultValue)
5957
}
6058
username = env("SNOWFLAKE_TEST_USER", "testuser")
6159
pass = env("SNOWFLAKE_TEST_PASSWORD", "testpassword")
@@ -107,10 +105,7 @@ func createDSN(timezone string) {
107105
// setup creates a test schema so that all tests can run in the same schema
108106
func setup() (string, error) {
109107
env := func(key, defaultValue string) string {
110-
if value := os.Getenv(key); value != "" {
111-
return value
112-
}
113-
return defaultValue
108+
return cmp.Or(os.Getenv(key), defaultValue)
114109
}
115110

116111
orgSchemaname := schemaname

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/snowflakedb/gosnowflake
22

3-
go 1.21
3+
go 1.22
44

55
require (
66
github.com/99designs/keyring v1.2.2

structured_type.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
type ObjectType struct {
2121
}
2222

23-
var structuredObjectWriterType = reflect.TypeOf((*StructuredObjectWriter)(nil)).Elem()
23+
var structuredObjectWriterType = reflect.TypeFor[StructuredObjectWriter]()
2424

2525
// StructuredObject is a representation of structured object for reading.
2626
type StructuredObject interface {

0 commit comments

Comments
 (0)