Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all dependencies #406

Merged
merged 4 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/golang-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [ '1.23' ]
go: [ '1.24' ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
30 changes: 10 additions & 20 deletions backend/couchdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,33 @@
package couchdb

import (
"context"
"net/http"

"github.com/caarlos0/env/v10"
"github.com/go-kivik/couchdb/v3"
kivik "github.com/go-kivik/kivik/v3"
"github.com/caarlos0/env/v11"
kivik "github.com/go-kivik/kivik/v4"
"github.com/go-kivik/kivik/v4/couchdb"

"github.com/pace/bricks/http/transport"
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
"github.com/pace/bricks/maintenance/log"
)

func DefaultDatabase() (*kivik.DB, error) {
return Database("")
}

func Database(name string) (*kivik.DB, error) {
ctx := log.WithContext(context.Background())

cfg, err := ParseConfig()
if err != nil {
return nil, err
}
// Primary client+db
_, db, err := clientAndDB(ctx, name, cfg)
_, db, err := clientAndDB(name, cfg)
if err != nil {
return nil, err
}

// Secondary (healthcheck) client+db
healthCheckClient, healthCheckDB, err := clientAndDB(ctx, name, cfg)
healthCheckClient, healthCheckDB, err := clientAndDB(name, cfg)
if err != nil {
return nil, err
}
Expand All @@ -49,7 +46,7 @@ func Database(name string) (*kivik.DB, error) {
return db, nil
}

func clientAndDB(ctx context.Context, dbName string, cfg *Config) (*kivik.Client, *kivik.DB, error) {
func clientAndDB(dbName string, cfg *Config) (*kivik.Client, *kivik.DB, error) {
client, err := Client(cfg)
if err != nil {
return nil, nil, err
Expand All @@ -60,20 +57,14 @@ func clientAndDB(ctx context.Context, dbName string, cfg *Config) (*kivik.Client
dbName = cfg.Database
}

db := client.DB(ctx, dbName, nil)
db := client.DB(dbName)
if db.Err() != nil {
return nil, nil, db.Err()
}
return client, db, err
}

func Client(cfg *Config) (*kivik.Client, error) {
ctx := log.WithContext(context.Background())

client, err := kivik.New("couch", cfg.URL)
if err != nil {
return nil, err
}
rts := []transport.ChainableRoundTripper{
&AuthTransport{
Username: cfg.User,
Expand All @@ -84,9 +75,8 @@ func Client(cfg *Config) (*kivik.Client, error) {
if !cfg.DisableRequestLogging {
rts = append(rts, &transport.LoggingRoundTripper{})
}
chain := transport.Chain(rts...)
tr := couchdb.SetTransport(chain)
err = client.Authenticate(ctx, tr)

client, err := kivik.New("couch", cfg.URL, couchdb.OptionHTTPClient(&http.Client{Transport: transport.Chain(rts...)}))
if err != nil {
return nil, err
}
Expand Down
32 changes: 20 additions & 12 deletions backend/couchdb/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"time"

kivik "github.com/go-kivik/kivik/v3"
kivik "github.com/go-kivik/kivik/v4"
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
)

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

checkTime := time.Now()

var doc Doc
var err error
var row *kivik.Row
var (
doc Doc
err error
row *kivik.Document
rev string
)

check:
// check if context was canceled
Expand All @@ -51,20 +54,25 @@ check:
}

row = h.DB.Get(ctx, h.Config.HealthCheckKey)
if row.Err != nil {
if kivik.StatusCode(row.Err) == http.StatusNotFound {
if err := row.Err(); err != nil {
if kivik.HTTPStatus(err) == http.StatusNotFound {
goto put
}
h.state.SetErrorState(fmt.Errorf("failed to get: %#v", row.Err))
h.state.SetErrorState(fmt.Errorf("failed to get: %#v", err))
return h.state.GetState()
}
defer row.Body.Close()
defer row.Close()

// check if document exists
if row.Rev != "" {
rev, err = row.Rev()
if err != nil {
h.state.SetErrorState(fmt.Errorf("failed to get document revision: %v", err))
}

if rev != "" {
err = row.ScanDoc(&doc)
if err != nil {
h.state.SetErrorState(fmt.Errorf("failed to get: %v", row.Err))
h.state.SetErrorState(fmt.Errorf("failed to get: %v", err))
return h.state.GetState()
}

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

if kivik.StatusCode(err) == http.StatusConflict {
if kivik.HTTPStatus(err) == http.StatusConflict {
goto check
}
h.state.SetErrorState(fmt.Errorf("failed to put object: %v", err))
Expand Down
2 changes: 1 addition & 1 deletion backend/k8sapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"os"
"strings"

"github.com/caarlos0/env/v10"
"github.com/caarlos0/env/v11"
"github.com/pace/bricks/http/transport"
"github.com/pace/bricks/maintenance/log"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/objstore/objstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"github.com/caarlos0/env/v10"
"github.com/caarlos0/env/v11"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"

Expand Down
4 changes: 2 additions & 2 deletions backend/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"strconv"
"time"

"github.com/caarlos0/env/v10"
"github.com/pace/bricks/backend/postgres/hooks"
"github.com/caarlos0/env/v11"
"github.com/pace/bricks/maintenance/health/servicehealthcheck"
"github.com/prometheus/client_golang/prometheus"
"github.com/uptrace/bun"
"github.com/uptrace/bun/dialect/pgdialect"
"github.com/uptrace/bun/driver/pgdriver"

"github.com/pace/bricks/backend/postgres/hooks"
"github.com/pace/bricks/maintenance/log"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/queue/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/caarlos0/env/v10"
"github.com/caarlos0/env/v11"
)

type config struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"time"

"github.com/caarlos0/env/v10"
"github.com/caarlos0/env/v11"
"github.com/getsentry/sentry-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/redis/go-redis/v9"
Expand Down
101 changes: 54 additions & 47 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pace/bricks

go 1.23.1
go 1.24.1

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

Expand All @@ -9,78 +9,85 @@ require (
github.com/adjust/rmq/v5 v5.2.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/bsm/redislock v0.9.3
github.com/caarlos0/env/v10 v10.0.0
github.com/caarlos0/env/v11 v11.3.1
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d
github.com/dave/jennifer v1.4.1
github.com/getkin/kin-openapi v0.0.0-20180813063848-e1956e8013e5
github.com/getsentry/sentry-go v0.29.0
github.com/go-kivik/couchdb/v3 v3.2.6
github.com/go-kivik/kivik/v3 v3.2.3
github.com/getkin/kin-openapi v0.129.0
github.com/getsentry/sentry-go v0.31.1
github.com/go-kivik/kivik/v4 v4.3.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1
github.com/jpillora/backoff v1.0.0
github.com/mattn/go-isatty v0.0.20
github.com/minio/minio-go/v7 v7.0.7
github.com/minio/minio-go/v7 v7.0.87
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.19.0
github.com/redis/go-redis/v9 v9.5.1
github.com/rs/xid v1.5.0
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/prometheus/client_golang v1.21.1
github.com/redis/go-redis/v9 v9.7.1
github.com/rs/xid v1.6.0
github.com/rs/zerolog v1.33.0
github.com/shopspring/decimal v1.3.1
github.com/sony/gobreaker v0.5.0
github.com/spf13/cobra v1.8.1
github.com/shopspring/decimal v1.4.0
github.com/sony/gobreaker/v2 v2.1.0
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.10.0
github.com/uptrace/bun v1.2.9
github.com/uptrace/bun/dialect/pgdialect v1.2.9
github.com/uptrace/bun/driver/pgdriver v1.2.9
github.com/uptrace/bun v1.2.11
github.com/uptrace/bun/dialect/pgdialect v1.2.11
github.com/uptrace/bun/driver/pgdriver v1.2.11
github.com/zenazn/goji v1.0.1
golang.org/x/text v0.22.0
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.36.4
golang.org/x/text v0.23.0
google.golang.org/grpc v1.71.0
google.golang.org/protobuf v1.36.5
)

require (
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect
github.com/alicebob/miniredis/v2 v2.30.4 // indirect
github.com/alicebob/miniredis/v2 v2.34.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-redsync/redsync/v4 v4.13.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/minio/md5-simd v1.1.0 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/otiai10/copy v1.14.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.0 // indirect
github.com/minio/crc64nvme v1.0.1 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasdiff/yaml v0.0.0-20241214135536-5f7845c759c8 // indirect
github.com/oasdiff/yaml3 v0.0.0-20241214160948-977117996672 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/net v0.37.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mellium.im/sasl v0.3.2 // indirect
)
Loading
Loading