Skip to content

Commit

Permalink
Merge pull request #189 from mailru/update-golang
Browse files Browse the repository at this point in the history
update golang to 1.20
  • Loading branch information
DoubleDi authored Nov 23, 2024
2 parents a1b09ec + 8ffd55a commit ea34956
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 48 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
- name: Checkout
uses: actions/checkout@v4

- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: latest

Expand All @@ -25,14 +27,19 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.15", "1.16", "1.17", "1.18"]
go: ["1.20", "1.21", "1.22", "1.23"]

steps:
- uses: actions/setup-go@v1
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v2
- run: go test -v -coverprofile=profile.cov ./...

- name: Run tests
run: go test -v -coverprofile=profile.cov ./...

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
Expand Down
5 changes: 2 additions & 3 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
Expand Down Expand Up @@ -220,7 +219,7 @@ func (c *conn) killQuery(req *http.Request) error {
}
if body != nil {
// Drain body to enable connection reuse
_, _ = io.Copy(ioutil.Discard, body)
_, _ = io.Copy(io.Discard, body)
body.Close()
}
return nil
Expand Down Expand Up @@ -259,7 +258,7 @@ func (c *conn) exec(ctx context.Context, query string, args []driver.Value) (dri
body, err := c.doRequest(ctx, req)
if body != nil {
// Drain body to enable connection reuse
_, _ = io.Copy(ioutil.Discard, body)
_, _ = io.Copy(io.Discard, body)
body.Close()
}
return emptyResult, err
Expand Down
4 changes: 2 additions & 2 deletions conn_go18.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"database/sql/driver"
"fmt"
"io/ioutil"
"io"
"strings"
)

Expand Down Expand Up @@ -37,7 +37,7 @@ func (c *conn) Ping(ctx context.Context) error {
defer respBody.Close()

// drain the response body to check if we got expected `1`
resp, err := ioutil.ReadAll(respBody)
resp, err := io.ReadAll(respBody)
if err != nil {
return fmt.Errorf("ping: failed to read the response: %w", err)
}
Expand Down
13 changes: 7 additions & 6 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"database/sql"
"database/sql/driver"
"io/ioutil"
"io"
"net/http"
"strings"
"testing"
Expand All @@ -17,6 +17,7 @@ import (
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/trace"
oteltrace "go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
)

var (
Expand Down Expand Up @@ -229,7 +230,7 @@ func (s *connSuite) TestBuildRequestReadonlyWithAuth() {
s.Equal(http.MethodPost, req.Method)
s.Equal(cn.url.String(), req.URL.String())
s.Nil(req.URL.User)
b, err := ioutil.ReadAll(req.Body)
b, err := io.ReadAll(req.Body)
s.Require().NoError(err)
s.Equal("SELECT 1", string(b))
}
Expand Down Expand Up @@ -400,7 +401,7 @@ func (s *connSuite) TestBuildRequestWithTraceContext() {
},
{
name: "trace context with noop trace provider",
traceProvider: oteltrace.NewNoopTracerProvider(),
traceProvider: noop.NewTracerProvider(),
propagator: propagation.TraceContext{},
expectedTraceHeaderPresent: false,
expectedValidSpan: false,
Expand All @@ -414,7 +415,7 @@ func (s *connSuite) TestBuildRequestWithTraceContext() {
},
{
name: "trace context with noop provider and propagator",
traceProvider: oteltrace.NewNoopTracerProvider(),
traceProvider: noop.NewTracerProvider(),
propagator: propagation.NewCompositeTextMapPropagator(),
expectedTraceHeaderPresent: false,
expectedValidSpan: false,
Expand Down Expand Up @@ -452,7 +453,7 @@ func (s *connSuite) TestBuildRequestParamsInterpolation() {
cn := newConn(NewConfig())
req, err := cn.buildRequest(context.Background(), query, make([]driver.Value, 0))
if s.NoError(err) {
body, e := ioutil.ReadAll(req.Body)
body, e := io.ReadAll(req.Body)
if s.NoError(e) {
s.Equal(query, string(body))
}
Expand All @@ -469,7 +470,7 @@ func (s *connSuite) TestRequestBodyGzipCompression() {
gz, err := gzip.NewReader(req.Body)
if s.NoError(err) {
defer gz.Close()
body, e := ioutil.ReadAll(gz)
body, e := io.ReadAll(gz)
if s.NoError(e) {
s.Equal(query, string(body))
}
Expand Down
22 changes: 16 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
module github.com/mailru/go-clickhouse/v2

go 1.20

require (
github.com/google/uuid v1.2.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/otel v1.7.0
go.opentelemetry.io/otel/sdk v1.7.0
go.opentelemetry.io/otel/trace v1.7.0
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
)

go 1.16
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
43 changes: 21 additions & 22 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM=
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
go.opentelemetry.io/otel/sdk v1.7.0 h1:4OmStpcKVOfvDOgCt7UriAPtKolwIhxpnSNI/yK+1B0=
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
go.opentelemetry.io/otel/trace v1.7.0 h1:O37Iogk1lEkMRXewVtZ1BBTVn5JEp8GrJvP92bJqC6o=
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
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=
3 changes: 1 addition & 2 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"database/sql/driver"
"io"
"io/ioutil"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -42,7 +41,7 @@ func TestTextRows(t *testing.T) {
return
}
assert.Equal(t, []driver.Value{int32(2), "world"}, dest)
data, err := ioutil.ReadAll(rows.respBody)
data, err := io.ReadAll(rows.respBody)
if !assert.NoError(t, err) {
return
}
Expand Down

0 comments on commit ea34956

Please sign in to comment.