mirror of
https://github.com/luxfi/zapdb.git
synced 2026-07-26 22:46:36 +00:00
fix: Go 1.26 vet compliance, grpc build tag in proto gen
- Fix format string vet errors in db2_test.go and key_registry.go for Go 1.26 stricter printf checks - Update pb/gen.sh to add //go:build grpc tag after protoc generation so protobuf types only compile with grpc tag (default uses ZAP native binary encoding from types_zap.go)
This commit is contained in:
+3
-3
@@ -241,7 +241,7 @@ func TestBigKeyValuePairs(t *testing.T) {
|
||||
}
|
||||
return item.Value(func(val []byte) error {
|
||||
if len(val) == 0 {
|
||||
log.Fatalf("key not found %q", len(key))
|
||||
log.Fatalf("key not found %d", len(key))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@@ -378,7 +378,7 @@ func TestBigValues(t *testing.T) {
|
||||
}
|
||||
return item.Value(func(val []byte) error {
|
||||
if len(val) == 0 || len(val) != len(data) || !bytes.Equal(val, data) {
|
||||
log.Fatalf("key not found %q", len(key))
|
||||
log.Fatalf("key not found %d", len(key))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@@ -602,7 +602,7 @@ func TestL0GCBug(t *testing.T) {
|
||||
success++
|
||||
}
|
||||
if err != nil && err != ErrNoRewrite {
|
||||
t.Fatalf(err.Error())
|
||||
t.Fatalf("%s", err.Error())
|
||||
}
|
||||
}
|
||||
// Ensure at least one GC call was successful.
|
||||
|
||||
+1
-1
@@ -399,7 +399,7 @@ func storeDataKey(buf *bytes.Buffer, storageKey []byte, k *pb.DataKey) error {
|
||||
// decrypting the datakey back.
|
||||
if err2 = xor(); err2 != nil {
|
||||
return y.Wrapf(err,
|
||||
y.Wrapf(err2, "Error while decrypting datakey in storeDataKey").Error())
|
||||
"%s", y.Wrapf(err2, "Error while decrypting datakey in storeDataKey").Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,3 +5,7 @@
|
||||
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
|
||||
protoc --go_out=. --go_opt=paths=source_relative badgerpb4.proto
|
||||
|
||||
# Add grpc build tag so protobuf types are only compiled when grpc tag is set.
|
||||
# The default (non-grpc) build uses native binary encoding from types_zap.go.
|
||||
sed -i.bak '1s/^/\/\/go:build grpc\n\n/' badgerpb4.pb.go && rm -f badgerpb4.pb.go.bak
|
||||
|
||||
Reference in New Issue
Block a user