proto/test: Fix go vet warnings

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-07-12 17:45:29 +03:00
parent b589a0e287
commit 305641ecb2

View file

@ -439,7 +439,7 @@ func TestFixed32Marshal(t *testing.T) {
})
}
func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives {
func testMarshal(t *testing.T, c stablePrimitives, tr *test.Primitives, wrongField bool) *test.Primitives {
var (
wire []byte
err error
@ -447,7 +447,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel
wire, err = c.stableMarshal(nil, wrongField)
require.NoError(t, err)
wireGen, err := goproto.Marshal(&tr)
wireGen, err := goproto.Marshal(tr)
require.NoError(t, err)
if !wrongField {
@ -470,7 +470,7 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) {
transport = test.Primitives{FieldA: data}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldA, len(data))
@ -488,7 +488,7 @@ func testStringMarshal(t *testing.T, s string, wrongField bool) {
transport = test.Primitives{FieldB: s}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldB, len(s))
@ -506,7 +506,7 @@ func testBoolMarshal(t *testing.T, b bool, wrongField bool) {
transport = test.Primitives{FieldC: b}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, b, result.FieldC)
@ -521,7 +521,7 @@ func testInt32Marshal(t *testing.T, n int32, wrongField bool) {
transport = test.Primitives{FieldD: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldD)
@ -536,7 +536,7 @@ func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) {
transport = test.Primitives{FieldE: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldE)
@ -551,7 +551,7 @@ func testInt64Marshal(t *testing.T, n int64, wrongField bool) {
transport = test.Primitives{FieldF: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldF)
@ -566,7 +566,7 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) {
transport = test.Primitives{FieldG: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldG)
@ -581,7 +581,7 @@ func testFloat64Marshal(t *testing.T, n float64, wrongField bool) {
transport = test.Primitives{FieldJ: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldJ)
@ -596,7 +596,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) {
transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.EqualValues(t, custom.FieldH, result.FieldH)
@ -605,7 +605,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) {
}
}
func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wrongField bool) *test.RepPrimitives {
func testRepMarshal(t *testing.T, c stableRepPrimitives, tr *test.RepPrimitives, wrongField bool) *test.RepPrimitives {
var (
wire []byte
err error
@ -613,7 +613,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives,
wire, err = c.stableMarshal(nil, wrongField)
require.NoError(t, err)
wireGen, err := goproto.Marshal(&tr)
wireGen, err := goproto.Marshal(tr)
require.NoError(t, err)
if !wrongField {
@ -636,7 +636,7 @@ func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) {
transport = test.RepPrimitives{FieldA: data}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldA, len(data))
@ -654,7 +654,7 @@ func testRepeatedStringMarshal(t *testing.T, s []string, wrongField bool) {
transport = test.RepPrimitives{FieldB: s}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldB, len(s))
@ -672,7 +672,7 @@ func testRepeatedInt32Marshal(t *testing.T, n []int32, wrongField bool) {
transport = test.RepPrimitives{FieldC: n}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldC, len(n))
@ -690,7 +690,7 @@ func testRepeatedUInt32Marshal(t *testing.T, n []uint32, wrongField bool) {
transport = test.RepPrimitives{FieldD: n}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldD, len(n))
@ -708,7 +708,7 @@ func testRepeatedInt64Marshal(t *testing.T, n []int64, wrongField bool) {
transport = test.RepPrimitives{FieldE: n}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldE, len(n))
@ -726,7 +726,7 @@ func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) {
transport = test.RepPrimitives{FieldF: n}
)
result := testRepMarshal(t, custom, transport, wrongField)
result := testRepMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Len(t, result.FieldF, len(n))
@ -744,7 +744,7 @@ func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) {
transport = test.Primitives{FieldI: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldI)
@ -759,7 +759,7 @@ func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) {
transport = test.Primitives{FieldK: n}
)
result := testMarshal(t, custom, transport, wrongField)
result := testMarshal(t, custom, &transport, wrongField)
if !wrongField {
require.Equal(t, n, result.FieldK)