Skip to content

Commit da49bdb

Browse files
GODRIVER-3455 Fix linting issues
1 parent fda086b commit da49bdb

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

bson/byte_slice_codec.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ import (
1212
)
1313

1414
// byteSliceCodec is the Codec used for []byte values.
15-
type byteSliceCodec struct {
16-
// encodeNilAsEmpty causes EncodeValue to marshal nil Go byte slices as empty BSON binary values
17-
// instead of BSON null.
18-
encodeNilAsEmpty bool
19-
}
15+
type byteSliceCodec struct{}
2016

2117
// Assert that byteSliceCodec satisfies the typeDecoder interface, which allows it to be
2218
// used by collection type decoders (e.g. map, slice, etc) to set individual values in a

bson/default_value_encoders.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func floatEncodeValueRF(_ EncodeContext, vw ValueWriter, val any) error {
190190
// floatEncodeValue is the ValueEncoderFunc for float types. this function is
191191
// used to decode "types" and "kinds" and therefore cannot be a wrapper for
192192
// reflection-free decoding in the default "type" case.
193-
func floatEncodeValue(ec EncodeContext, vw ValueWriter, val reflect.Value) error {
193+
func floatEncodeValue(_ EncodeContext, vw ValueWriter, val reflect.Value) error {
194194
switch val.Kind() {
195195
case reflect.Float32, reflect.Float64:
196196
return vw.WriteDouble(val.Float())
@@ -664,7 +664,7 @@ func byteSliceEncodeValue(encodeNilAsEmpty bool) defaultValueEncoderFunc {
664664
})
665665
}
666666

667-
func timeEncodeValueRF(ec EncodeContext, vw ValueWriter, val any) error {
667+
func timeEncodeValueRF(_ EncodeContext, vw ValueWriter, val any) error {
668668
tt, ok := val.(time.Time)
669669
if !ok {
670670
return ValueEncoderError{Name: "TimeEncodeValue", Types: []reflect.Type{tTime}, Received: reflect.ValueOf(val)}
@@ -678,7 +678,7 @@ func timeEncodeValue(ec EncodeContext, vw ValueWriter, val reflect.Value) error
678678
return timeEncodeValueRF(ec, vw, val.Interface())
679679
}
680680

681-
func coreArrayEncodeValueRF(ec EncodeContext, vw ValueWriter, val any) error {
681+
func coreArrayEncodeValueRF(_ EncodeContext, vw ValueWriter, val any) error {
682682
arr, ok := val.(bsoncore.Array)
683683
if !ok {
684684
return ValueEncoderError{Name: "CoreArrayEncodeValue", Types: []reflect.Type{tCoreArray}, Received: reflect.ValueOf(val)}

bson/default_value_encoders_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ func TestDefaultValueEncoders(t *testing.T) {
571571
{
572572
"ByteSliceEncodeValue",
573573
ValueEncoderFunc(byteSliceEncodeValue(false)),
574-
reflectFreeValueEncoderFunc(byteSliceEncodeValueRF(false)),
574+
byteSliceEncodeValueRF(false),
575575
[]subtest{
576576
{
577577
"wrong type",

bson/registry.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ func (r *Registry) registerReflectFreeTypeEncoder(valueType reflect.Type, enc re
126126
r.reflectFreeTypeEncoders.Store(valueType, enc)
127127
}
128128

129-
func (r *Registry) storeReflectFreeTypeEncoder(rt reflect.Type, enc reflectFreeValueEncoder) reflectFreeValueEncoder {
130-
return r.reflectFreeTypeEncoders.LoadOrStore(rt, enc)
131-
}
132-
133129
// RegisterTypeDecoder registers the provided ValueDecoder for the provided type.
134130
//
135131
// The type will be used as provided, so a decoder can be registered for a type and a different

0 commit comments

Comments
 (0)