Skip to content

Commit df0dbe8

Browse files
Merge pull request #406 from pace/gomod-update
This updates all dependencies to the latest version, excluding github.com/bsm/redislock github.com/dave/jennifer as newer versions lead to unwanted behavior.
2 parents 88f3d21 + aeaa1bc commit df0dbe8

File tree

29 files changed

+343
-319
lines changed

29 files changed

+343
-319
lines changed

.github/workflows/golang-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
go: [ '1.23' ]
9+
go: [ '1.24' ]
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-go@v5

backend/couchdb/db.go

+10-20
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,33 @@
33
package couchdb
44

55
import (
6-
"context"
6+
"net/http"
77

8-
"github.com/caarlos0/env/v10"
9-
"github.com/go-kivik/couchdb/v3"
10-
kivik "github.com/go-kivik/kivik/v3"
8+
"github.com/caarlos0/env/v11"
9+
kivik "github.com/go-kivik/kivik/v4"
10+
"github.com/go-kivik/kivik/v4/couchdb"
1111

1212
"github.com/pace/bricks/http/transport"
1313
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
14-
"github.com/pace/bricks/maintenance/log"
1514
)
1615

1716
func DefaultDatabase() (*kivik.DB, error) {
1817
return Database("")
1918
}
2019

2120
func Database(name string) (*kivik.DB, error) {
22-
ctx := log.WithContext(context.Background())
23-
2421
cfg, err := ParseConfig()
2522
if err != nil {
2623
return nil, err
2724
}
2825
// Primary client+db
29-
_, db, err := clientAndDB(ctx, name, cfg)
26+
_, db, err := clientAndDB(name, cfg)
3027
if err != nil {
3128
return nil, err
3229
}
3330

3431
// Secondary (healthcheck) client+db
35-
healthCheckClient, healthCheckDB, err := clientAndDB(ctx, name, cfg)
32+
healthCheckClient, healthCheckDB, err := clientAndDB(name, cfg)
3633
if err != nil {
3734
return nil, err
3835
}
@@ -49,7 +46,7 @@ func Database(name string) (*kivik.DB, error) {
4946
return db, nil
5047
}
5148

52-
func clientAndDB(ctx context.Context, dbName string, cfg *Config) (*kivik.Client, *kivik.DB, error) {
49+
func clientAndDB(dbName string, cfg *Config) (*kivik.Client, *kivik.DB, error) {
5350
client, err := Client(cfg)
5451
if err != nil {
5552
return nil, nil, err
@@ -60,20 +57,14 @@ func clientAndDB(ctx context.Context, dbName string, cfg *Config) (*kivik.Client
6057
dbName = cfg.Database
6158
}
6259

63-
db := client.DB(ctx, dbName, nil)
60+
db := client.DB(dbName)
6461
if db.Err() != nil {
6562
return nil, nil, db.Err()
6663
}
6764
return client, db, err
6865
}
6966

7067
func Client(cfg *Config) (*kivik.Client, error) {
71-
ctx := log.WithContext(context.Background())
72-
73-
client, err := kivik.New("couch", cfg.URL)
74-
if err != nil {
75-
return nil, err
76-
}
7768
rts := []transport.ChainableRoundTripper{
7869
&AuthTransport{
7970
Username: cfg.User,
@@ -84,9 +75,8 @@ func Client(cfg *Config) (*kivik.Client, error) {
8475
if !cfg.DisableRequestLogging {
8576
rts = append(rts, &transport.LoggingRoundTripper{})
8677
}
87-
chain := transport.Chain(rts...)
88-
tr := couchdb.SetTransport(chain)
89-
err = client.Authenticate(ctx, tr)
78+
79+
client, err := kivik.New("couch", cfg.URL, couchdb.OptionHTTPClient(&http.Client{Transport: transport.Chain(rts...)}))
9080
if err != nil {
9181
return nil, err
9282
}

backend/couchdb/health_check.go

+20-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http"
77
"time"
88

9-
kivik "github.com/go-kivik/kivik/v3"
9+
kivik "github.com/go-kivik/kivik/v4"
1010
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
1111
)
1212

@@ -37,9 +37,12 @@ func (h *HealthCheck) HealthCheck(ctx context.Context) servicehealthcheck.Health
3737

3838
checkTime := time.Now()
3939

40-
var doc Doc
41-
var err error
42-
var row *kivik.Row
40+
var (
41+
doc Doc
42+
err error
43+
row *kivik.Document
44+
rev string
45+
)
4346

4447
check:
4548
// check if context was canceled
@@ -51,20 +54,25 @@ check:
5154
}
5255

5356
row = h.DB.Get(ctx, h.Config.HealthCheckKey)
54-
if row.Err != nil {
55-
if kivik.StatusCode(row.Err) == http.StatusNotFound {
57+
if err := row.Err(); err != nil {
58+
if kivik.HTTPStatus(err) == http.StatusNotFound {
5659
goto put
5760
}
58-
h.state.SetErrorState(fmt.Errorf("failed to get: %#v", row.Err))
61+
h.state.SetErrorState(fmt.Errorf("failed to get: %#v", err))
5962
return h.state.GetState()
6063
}
61-
defer row.Body.Close()
64+
defer row.Close()
6265

6366
// check if document exists
64-
if row.Rev != "" {
67+
rev, err = row.Rev()
68+
if err != nil {
69+
h.state.SetErrorState(fmt.Errorf("failed to get document revision: %v", err))
70+
}
71+
72+
if rev != "" {
6573
err = row.ScanDoc(&doc)
6674
if err != nil {
67-
h.state.SetErrorState(fmt.Errorf("failed to get: %v", row.Err))
75+
h.state.SetErrorState(fmt.Errorf("failed to get: %v", err))
6876
return h.state.GetState()
6977
}
7078

@@ -81,7 +89,7 @@ put:
8189
_, err = h.DB.Put(ctx, h.Config.HealthCheckKey, doc)
8290
if err != nil {
8391
// not yet created, try to create
84-
if h.Config.DatabaseAutoCreate && kivik.StatusCode(err) == http.StatusNotFound {
92+
if h.Config.DatabaseAutoCreate && kivik.HTTPStatus(err) == http.StatusNotFound {
8593
err := h.Client.CreateDB(ctx, h.Name)
8694
if err != nil {
8795
h.state.SetErrorState(fmt.Errorf("failed to put object: %v", err))
@@ -90,7 +98,7 @@ put:
9098
goto put
9199
}
92100

93-
if kivik.StatusCode(err) == http.StatusConflict {
101+
if kivik.HTTPStatus(err) == http.StatusConflict {
94102
goto check
95103
}
96104
h.state.SetErrorState(fmt.Errorf("failed to put object: %v", err))

backend/k8sapi/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"os"
1515
"strings"
1616

17-
"github.com/caarlos0/env/v10"
17+
"github.com/caarlos0/env/v11"
1818
"github.com/pace/bricks/http/transport"
1919
"github.com/pace/bricks/maintenance/log"
2020
)

backend/objstore/objstore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"sync"
77
"time"
88

9-
"github.com/caarlos0/env/v10"
9+
"github.com/caarlos0/env/v11"
1010
"github.com/minio/minio-go/v7"
1111
"github.com/minio/minio-go/v7/pkg/credentials"
1212

backend/postgres/postgres.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import (
1111
"strconv"
1212
"time"
1313

14-
"github.com/caarlos0/env/v10"
15-
"github.com/pace/bricks/backend/postgres/hooks"
14+
"github.com/caarlos0/env/v11"
1615
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
1716
"github.com/prometheus/client_golang/prometheus"
1817
"github.com/uptrace/bun"
1918
"github.com/uptrace/bun/dialect/pgdialect"
2019
"github.com/uptrace/bun/driver/pgdriver"
2120

21+
"github.com/pace/bricks/backend/postgres/hooks"
2222
"github.com/pace/bricks/maintenance/log"
2323
)
2424

backend/queue/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"log"
55
"time"
66

7-
"github.com/caarlos0/env/v10"
7+
"github.com/caarlos0/env/v11"
88
)
99

1010
type config struct {

backend/redis/redis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"context"
88
"time"
99

10-
"github.com/caarlos0/env/v10"
10+
"github.com/caarlos0/env/v11"
1111
"github.com/getsentry/sentry-go"
1212
"github.com/prometheus/client_golang/prometheus"
1313
"github.com/redis/go-redis/v9"

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ services:
5656
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
5757

5858
testserver:
59-
image: "golang:1.23"
59+
image: "golang:1.24"
6060
volumes:
6161
- .:/srv
6262
working_dir: /srv

go.mod

+54-47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/pace/bricks
22

3-
go 1.23.1
3+
go 1.24.1
44

55
replace github.com/asaskevich/govalidator => github.com/pieceofsoul/govalidator v0.0.0-20230607103513-8dce951b10b8
66

@@ -9,78 +9,85 @@ require (
99
github.com/adjust/rmq/v5 v5.2.0
1010
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
1111
github.com/bsm/redislock v0.9.3
12-
github.com/caarlos0/env/v10 v10.0.0
12+
github.com/caarlos0/env/v11 v11.3.1
1313
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d
1414
github.com/dave/jennifer v1.4.1
15-
github.com/getkin/kin-openapi v0.0.0-20180813063848-e1956e8013e5
16-
github.com/getsentry/sentry-go v0.29.0
17-
github.com/go-kivik/couchdb/v3 v3.2.6
18-
github.com/go-kivik/kivik/v3 v3.2.3
15+
github.com/getkin/kin-openapi v0.129.0
16+
github.com/getsentry/sentry-go v0.31.1
17+
github.com/go-kivik/kivik/v4 v4.3.3
1918
github.com/golang-jwt/jwt/v5 v5.2.1
2019
github.com/google/uuid v1.6.0
2120
github.com/gorilla/mux v1.8.1
2221
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
23-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0
22+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1
2423
github.com/jpillora/backoff v1.0.0
2524
github.com/mattn/go-isatty v0.0.20
26-
github.com/minio/minio-go/v7 v7.0.7
25+
github.com/minio/minio-go/v7 v7.0.87
2726
github.com/pkg/errors v0.9.1
28-
github.com/pmezard/go-difflib v1.0.0
29-
github.com/prometheus/client_golang v1.19.0
30-
github.com/redis/go-redis/v9 v9.5.1
31-
github.com/rs/xid v1.5.0
27+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
28+
github.com/prometheus/client_golang v1.21.1
29+
github.com/redis/go-redis/v9 v9.7.1
30+
github.com/rs/xid v1.6.0
3231
github.com/rs/zerolog v1.33.0
33-
github.com/shopspring/decimal v1.3.1
34-
github.com/sony/gobreaker v0.5.0
35-
github.com/spf13/cobra v1.8.1
32+
github.com/shopspring/decimal v1.4.0
33+
github.com/sony/gobreaker/v2 v2.1.0
34+
github.com/spf13/cobra v1.9.1
3635
github.com/stretchr/testify v1.10.0
37-
github.com/uptrace/bun v1.2.9
38-
github.com/uptrace/bun/dialect/pgdialect v1.2.9
39-
github.com/uptrace/bun/driver/pgdriver v1.2.9
36+
github.com/uptrace/bun v1.2.11
37+
github.com/uptrace/bun/dialect/pgdialect v1.2.11
38+
github.com/uptrace/bun/driver/pgdriver v1.2.11
4039
github.com/zenazn/goji v1.0.1
41-
golang.org/x/text v0.22.0
42-
google.golang.org/grpc v1.67.1
43-
google.golang.org/protobuf v1.36.4
40+
golang.org/x/text v0.23.0
41+
google.golang.org/grpc v1.71.0
42+
google.golang.org/protobuf v1.36.5
4443
)
4544

4645
require (
4746
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect
48-
github.com/alicebob/miniredis/v2 v2.30.4 // indirect
47+
github.com/alicebob/miniredis/v2 v2.34.0 // indirect
4948
github.com/beorn7/perks v1.0.1 // indirect
5049
github.com/cespare/xxhash/v2 v2.3.0 // indirect
51-
github.com/davecgh/go-spew v1.1.1 // indirect
50+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
5251
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
53-
github.com/ghodss/yaml v1.0.0 // indirect
52+
github.com/dustin/go-humanize v1.0.1 // indirect
53+
github.com/go-ini/ini v1.67.0 // indirect
54+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
55+
github.com/go-openapi/swag v0.23.0 // indirect
56+
github.com/go-redsync/redsync/v4 v4.13.0 // indirect
57+
github.com/goccy/go-json v0.10.5 // indirect
58+
github.com/hashicorp/errwrap v1.1.0 // indirect
59+
github.com/hashicorp/go-multierror v1.1.1 // indirect
5460
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5561
github.com/jinzhu/inflection v1.0.0 // indirect
56-
github.com/json-iterator/go v1.1.12 // indirect
57-
github.com/klauspost/cpuid v1.3.1 // indirect
62+
github.com/josharian/intern v1.0.0 // indirect
63+
github.com/klauspost/compress v1.18.0 // indirect
64+
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
65+
github.com/mailru/easyjson v0.9.0 // indirect
5866
github.com/mattn/go-colorable v0.1.14 // indirect
59-
github.com/minio/md5-simd v1.1.0 // indirect
60-
github.com/minio/sha256-simd v0.1.1 // indirect
61-
github.com/mitchellh/go-homedir v1.1.0 // indirect
62-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
63-
github.com/modern-go/reflect2 v1.0.2 // indirect
64-
github.com/otiai10/copy v1.14.0 // indirect
65-
github.com/prometheus/client_model v0.5.0 // indirect
66-
github.com/prometheus/common v0.48.0 // indirect
67-
github.com/prometheus/procfs v0.12.0 // indirect
68-
github.com/puzpuzpuz/xsync/v3 v3.5.0 // indirect
67+
github.com/minio/crc64nvme v1.0.1 // indirect
68+
github.com/minio/md5-simd v1.1.2 // indirect
69+
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
70+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
71+
github.com/oasdiff/yaml v0.0.0-20241214135536-5f7845c759c8 // indirect
72+
github.com/oasdiff/yaml3 v0.0.0-20241214160948-977117996672 // indirect
73+
github.com/perimeterx/marshmallow v1.1.5 // indirect
74+
github.com/prometheus/client_model v0.6.1 // indirect
75+
github.com/prometheus/common v0.62.0 // indirect
76+
github.com/prometheus/procfs v0.15.1 // indirect
77+
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
6978
github.com/rogpeppe/go-internal v1.13.1 // indirect
70-
github.com/spf13/pflag v1.0.5 // indirect
79+
github.com/spf13/pflag v1.0.6 // indirect
7180
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
7281
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
7382
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
74-
github.com/yuin/gopher-lua v1.1.0 // indirect
75-
go.opentelemetry.io/otel v1.34.0 // indirect
76-
go.opentelemetry.io/otel/trace v1.34.0 // indirect
77-
golang.org/x/crypto v0.33.0 // indirect
78-
golang.org/x/net v0.35.0 // indirect
79-
golang.org/x/sys v0.30.0 // indirect
80-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
81-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
82-
gopkg.in/ini.v1 v1.67.0 // indirect
83-
gopkg.in/yaml.v2 v2.4.0 // indirect
83+
github.com/yuin/gopher-lua v1.1.1 // indirect
84+
go.opentelemetry.io/otel v1.35.0 // indirect
85+
go.opentelemetry.io/otel/trace v1.35.0 // indirect
86+
golang.org/x/crypto v0.36.0 // indirect
87+
golang.org/x/net v0.37.0 // indirect
88+
golang.org/x/sync v0.12.0 // indirect
89+
golang.org/x/sys v0.31.0 // indirect
90+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
8491
gopkg.in/yaml.v3 v3.0.1 // indirect
8592
mellium.im/sasl v0.3.2 // indirect
8693
)

0 commit comments

Comments
 (0)