databricks / databricks-sql-go

Golang database/sql driver for Databricks SQL.
Apache License 2.0
34 stars 37 forks source link

Compilation failure with go 1.21 #191

Open aaditya-khetan opened 4 months ago

aaditya-khetan commented 4 months ago

I upgraded by golang application from go 1.20 to go 1.21, after which on running go build I am getting the below error.

`#15 ERROR: process "/bin/sh -c GOOS=$TARGETOS CGO_ENABLED=1 GOARCH=$TARGETARCH go build -tags=musl,dynamic -ldflags=\"-w -s\" -o /go/bin/irctc-gateway cmd/server/main.go" did not complete successfully: exit code: 1

[build-env 8/8] RUN GOOS=linux CGO_ENABLED=1 GOARCH=arm64 go build -tags=musl,dynamic -ldflags="-w -s" -o /go/bin/irctc-gateway cmd/server/main.go:

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29691:49: undefined: context.CancelCauseFunc

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29716:25: undefined: context.Cause

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29780:24: undefined: context.CancelCauseFunc

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29781:27: undefined: context.WithCancelCause

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29786:49: undefined: context.CancelCauseFunc

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29811:25: undefined: context.Cause

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29875:24: undefined: context.CancelCauseFunc

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29876:27: undefined: context.WithCancelCause

15 427.6 /go/pkg/mod/github.com/databricks/databricks-sql-go@v1.5.2/internal/cli_service/cli_service.go:29876:27: too many errors

15 427.6 note: module requires Go 1.20`

Is databricks-sql-go compatible with go 1.21 ? Databricks version -> v1.5.2 Golang version -> go 1.21.5

kravets-levko commented 2 months ago

Hi @aaditya-khetan! I don't think it's the issue with the library itself, rather with the environment you're using. I use go1.22.1 darwin/amd64 and it does build the library just fine. Can you please also share your OS type and version and libc version?