Skip to content

Commit

Permalink
Pull request #36: Upgrade dependencies
Browse files Browse the repository at this point in the history
Merge in PRODUCT/squirreldb from upgrade-deps-2022-11-02 to master

* commit 'b91cc0ba8e91b5a904a1fcc5223c2f8ebd3b697a':
  Upgrade goreleaser to v1.12.3
  Upgrade golangci-lint to v1.50.1
  Upgrade go dependencies
  Use multiline commands, add lint and coverage options
  • Loading branch information
ozon2 authored and PierreF committed Nov 15, 2022
2 parents a7d0c31 + b91cc0b commit 2d4c6cb
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 151 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,5 +786,5 @@ func textToLabels(text string) (labels.Labels, error) {
builder.Set(v.Name, v.Value)
}

return builder.Labels(), nil
return builder.Labels(nil), nil
}
26 changes: 22 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
USER_UID=$(id -u)

# Should be the same as run-tests.sh
GORELEASER_VERSION="v1.11.4"
GORELEASER_VERSION="v1.12.3"

case "$1" in
"")
Expand Down Expand Up @@ -38,16 +38,26 @@ fi

export SQUIRRELDB_VERSION

COMMIT=`git rev-parse --short HEAD || echo "unknown"`

if [ "${ONLY_GO}" = "1" -a "${WITH_RACE}" != "1" ]; then
docker run --rm -e HOME=/go/pkg -e CGO_ENABLED=0 \
-v $(pwd):/src -w /src ${GO_MOUNT_CACHE} \
--entrypoint '' \
goreleaser/goreleaser:${GORELEASER_VERSION} sh -c "go build . && chown $USER_UID squirreldb"
goreleaser/goreleaser:${GORELEASER_VERSION} \
sh -exc "
go build -ldflags='-X main.version=${SQUIRRELDB_VERSION} -X main.commit=${COMMIT}' .
chown $USER_UID squirreldb
"
elif [ "${ONLY_GO}" = "1" -a "${WITH_RACE}" = "1" ]; then
docker run --rm -e HOME=/go/pkg -e CGO_ENABLED=1 \
-v $(pwd):/src -w /src ${GO_MOUNT_CACHE} \
--entrypoint '' \
goreleaser/goreleaser:${GORELEASER_VERSION} sh -c "go build -ldflags='-linkmode external -extldflags=-static' -race . && chown $USER_UID squirreldb"
goreleaser/goreleaser:${GORELEASER_VERSION} \
sh -exc "
go build -ldflags='-X main.version=${SQUIRRELDB_VERSION} -X main.commit=${COMMIT} -linkmode external -extldflags=-static' -race .
chown $USER_UID squirreldb
"
else
docker run --rm -e HOME=/go/pkg -e CGO_ENABLED=0 \
-v $(pwd):/src -w /src ${GO_MOUNT_CACHE} \
Expand All @@ -56,7 +66,15 @@ else
-e SQUIRRELDB_VERSION \
-e GORELEASER_PREVIOUS_TAG=0.1.0 \
-e GORELEASER_CURRENT_TAG=0.1.1 \
goreleaser/goreleaser:${GORELEASER_VERSION} sh -c "(mkdir -p /go/pkg && git config --global --add safe.directory /src && goreleaser check && go test ./... && goreleaser --rm-dist --snapshot --parallelism 2);result=\$?;chown -R $USER_UID dist; exit \$result"
goreleaser/goreleaser:${GORELEASER_VERSION} \
sh -exc "
mkdir -p /go/pkg
git config --global --add safe.directory /src
goreleaser check
go test ./...
goreleaser --rm-dist --snapshot --parallelism 2
chown -R $USER_UID dist
"

echo $SQUIRRELDB_VERSION > dist/VERSION

Expand Down
8 changes: 4 additions & 4 deletions cassandra/index/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ func dropTTLFromMetricList(input []labels.Labels) []labels.Labels {
builder := labels.NewBuilder(metric)
builder.Del(timeToLiveLabelName)

result = append(result, builder.Labels())
result = append(result, builder.Labels(nil))
}

return result
Expand Down Expand Up @@ -5628,7 +5628,7 @@ func Test_expiration_longlived(t *testing.T) { //nolint:maintidx
// randomize between shortestTTL & longTTL
rndSecond := shortestTTL.Seconds() + rnd.Float64()*(longTTL.Seconds()-shortestTTL.Seconds())
builder.Set("__ttl__", strconv.FormatInt(int64(rndSecond), 10))
metricsRandomTTL[i] = builder.Labels()
metricsRandomTTL[i] = builder.Labels(nil)

rndExpirationByShard[i][nextShard] = currentTime.Add(time.Duration(rndSecond) * time.Second)
}
Expand Down Expand Up @@ -5749,13 +5749,13 @@ func Test_expiration_longlived(t *testing.T) { //nolint:maintidx
for i := range metricsLongToShortTTL {
builder := labels.NewBuilder(metricsLongToShortTTL[i])
builder.Set("__ttl__", strconv.FormatInt(int64(shortTTL.Seconds()), 10))
metricsLongToShortTTL[i] = builder.Labels()
metricsLongToShortTTL[i] = builder.Labels(nil)
}

for i := range metricsShortToLongTTL {
builder := labels.NewBuilder(metricsShortToLongTTL[i])
builder.Set("__ttl__", strconv.FormatInt(int64(longTTL.Seconds()), 10))
metricsShortToLongTTL[i] = builder.Labels()
metricsShortToLongTTL[i] = builder.Labels(nil)
}
case currentPhase == 2 && nextPhase == 3:
// End of phase 2
Expand Down
8 changes: 4 additions & 4 deletions cassandra/mutable/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (cp *Provider) MutableLabelNames(tenant string) ([]string, error) {

// WriteLabelValues writes the label values to the store.
func (cp *Provider) WriteLabelValues(ctx context.Context, lbls []LabelWithValues) error {
// We use a map to to append only distinct values in the label keys.
// We use a map to append only distinct values in the label keys.
usedKeys := make(map[LabelKey]struct{})
keys := make([]LabelKey, 0, len(lbls))
usedTenants := make(map[string]struct{})
Expand Down Expand Up @@ -251,7 +251,7 @@ func (cp *Provider) WriteLabelValues(ctx context.Context, lbls []LabelWithValues

// DeleteLabelValues deletes label values in the store.
func (cp *Provider) DeleteLabelValues(ctx context.Context, lbls []Label) error {
// We use a map to to append only distinct values in the label keys.
// We use a map to append only distinct values in the label keys.
usedKeys := make(map[LabelKey]struct{})
keys := make([]LabelKey, 0, len(lbls))
usedTenants := make(map[string]struct{})
Expand Down Expand Up @@ -284,7 +284,7 @@ func (cp *Provider) DeleteLabelValues(ctx context.Context, lbls []Label) error {

// WriteLabelNames writes the label names to the store.
func (cp *Provider) WriteLabelNames(ctx context.Context, lbls []LabelWithName) error {
// We use a map to to append only distinct values in the tenants.
// We use a map to append only distinct values in the tenants.
used := make(map[string]struct{})
tenants := make([]string, 0, len(lbls))

Expand All @@ -308,7 +308,7 @@ func (cp *Provider) WriteLabelNames(ctx context.Context, lbls []LabelWithName) e

// DeleteLabelNames deletes mutable label names in the store.
func (cp *Provider) DeleteLabelNames(ctx context.Context, labelKeys []LabelKey) error {
// We use a map to to append only distinct values in the tenants.
// We use a map to append only distinct values in the tenants.
used := make(map[string]struct{})
tenants := make([]string, 0, len(labelKeys))

Expand Down
4 changes: 2 additions & 2 deletions cassandra/tsdb/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (

const concurrentWriterCount = 4 // Number of Gorouting writing concurrently

// Write writes all specified metrics
// metrics points should be sorted and deduplicated.
// Write writes all specified metrics.
// Metric points should be sorted and deduplicated.
func (c *CassandraTSDB) Write(ctx context.Context, metrics []types.MetricData) error {
return c.InternalWrite(ctx, metrics, 0)
}
Expand Down
2 changes: 1 addition & 1 deletion dummy/locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type tryLocker struct {
}

// CreateLock return a TryLocker for given name.
// This locker is NOT common across all SquirrelDB and not even this process. It's only common this this factory.
// This locker is NOT common across all SquirrelDB and not even this process. It's only common to this factory.
// timeToLive is ignored, as it normally only used in case of crash to release the lock.
func (l *Locks) CreateLock(name string, timeToLive time.Duration) types.TryLocker {
l.globalMutex.Lock()
Expand Down
68 changes: 41 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,29 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2
github.com/knadh/koanf v1.4.3
github.com/pilosa/pilosa/v2 v2.0.0-alpha.1.0.20200910211802-052440974ac5
github.com/prometheus/client_golang v1.13.0
github.com/prometheus/client_model v0.2.0
github.com/grafana/regexp v0.0.0-20221005092906-f072a00f63e9
github.com/knadh/koanf v1.4.4
github.com/pilosa/pilosa/v2 v2.9.0
github.com/prometheus/client_golang v1.13.1
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.37.0
github.com/prometheus/procfs v0.8.0
github.com/prometheus/prometheus v0.38.0
github.com/prometheus/prometheus v0.39.1
github.com/rs/zerolog v1.28.0
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/pflag v1.0.5
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7
golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25
golang.org/x/sync v0.1.0
golang.org/x/sys v0.1.0
)

require (
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.106 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.128 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -41,59 +44,70 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/getsentry/sentry-go v0.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.14.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.21.2 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/loads v0.21.1 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/strfmt v0.21.3 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-openapi/validate v0.21.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.3.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/memberlist v0.4.0 // indirect
github.com/hashicorp/memberlist v0.5.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/molecula/apophenia v0.0.0-20190827192002-68b7a14a478b // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/alertmanager v0.24.0 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/stretchr/testify v1.8.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.5.0 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/metric v0.32.1 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
go.mongodb.org/mongo-driver v1.10.2 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4 // indirect
go.opentelemetry.io/otel v1.11.1 // indirect
go.opentelemetry.io/otel/metric v0.33.0 // indirect
go.opentelemetry.io/otel/trace v1.11.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.0 // indirect
golang.org/x/net v0.0.0-20220926192436-02166a98028e // indirect
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.1.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce // indirect
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 2d4c6cb

Please sign in to comment.