forked from TrueCloudLab/frostfs-api-go
[#90] proto/test: Fix go vet warnings
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
3f92d7bfb0
commit
610c450a65
1 changed files with 21 additions and 21 deletions
|
@ -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 (
|
var (
|
||||||
wire []byte
|
wire []byte
|
||||||
err error
|
err error
|
||||||
|
@ -447,7 +447,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel
|
||||||
wire, err = c.stableMarshal(nil, wrongField)
|
wire, err = c.stableMarshal(nil, wrongField)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
wireGen, err := goproto.Marshal(&tr)
|
wireGen, err := goproto.Marshal(tr)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
|
@ -470,7 +470,7 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) {
|
||||||
transport = test.Primitives{FieldA: data}
|
transport = test.Primitives{FieldA: data}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldA, len(data))
|
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}
|
transport = test.Primitives{FieldB: s}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldB, len(s))
|
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}
|
transport = test.Primitives{FieldC: b}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, b, result.FieldC)
|
require.Equal(t, b, result.FieldC)
|
||||||
|
@ -521,7 +521,7 @@ func testInt32Marshal(t *testing.T, n int32, wrongField bool) {
|
||||||
transport = test.Primitives{FieldD: n}
|
transport = test.Primitives{FieldD: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldD)
|
require.Equal(t, n, result.FieldD)
|
||||||
|
@ -536,7 +536,7 @@ func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) {
|
||||||
transport = test.Primitives{FieldE: n}
|
transport = test.Primitives{FieldE: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldE)
|
require.Equal(t, n, result.FieldE)
|
||||||
|
@ -551,7 +551,7 @@ func testInt64Marshal(t *testing.T, n int64, wrongField bool) {
|
||||||
transport = test.Primitives{FieldF: n}
|
transport = test.Primitives{FieldF: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldF)
|
require.Equal(t, n, result.FieldF)
|
||||||
|
@ -566,7 +566,7 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) {
|
||||||
transport = test.Primitives{FieldG: n}
|
transport = test.Primitives{FieldG: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldG)
|
require.Equal(t, n, result.FieldG)
|
||||||
|
@ -581,7 +581,7 @@ func testFloat64Marshal(t *testing.T, n float64, wrongField bool) {
|
||||||
transport = test.Primitives{FieldJ: n}
|
transport = test.Primitives{FieldJ: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldJ)
|
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)}
|
transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.EqualValues(t, custom.FieldH, result.FieldH)
|
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 (
|
var (
|
||||||
wire []byte
|
wire []byte
|
||||||
err error
|
err error
|
||||||
|
@ -613,7 +613,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives,
|
||||||
wire, err = c.stableMarshal(nil, wrongField)
|
wire, err = c.stableMarshal(nil, wrongField)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
wireGen, err := goproto.Marshal(&tr)
|
wireGen, err := goproto.Marshal(tr)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
|
@ -636,7 +636,7 @@ func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) {
|
||||||
transport = test.RepPrimitives{FieldA: data}
|
transport = test.RepPrimitives{FieldA: data}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldA, len(data))
|
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}
|
transport = test.RepPrimitives{FieldB: s}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldB, len(s))
|
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}
|
transport = test.RepPrimitives{FieldC: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldC, len(n))
|
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}
|
transport = test.RepPrimitives{FieldD: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldD, len(n))
|
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}
|
transport = test.RepPrimitives{FieldE: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldE, len(n))
|
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}
|
transport = test.RepPrimitives{FieldF: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testRepMarshal(t, custom, transport, wrongField)
|
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Len(t, result.FieldF, len(n))
|
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}
|
transport = test.Primitives{FieldI: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldI)
|
require.Equal(t, n, result.FieldI)
|
||||||
|
@ -759,7 +759,7 @@ func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) {
|
||||||
transport = test.Primitives{FieldK: n}
|
transport = test.Primitives{FieldK: n}
|
||||||
)
|
)
|
||||||
|
|
||||||
result := testMarshal(t, custom, transport, wrongField)
|
result := testMarshal(t, custom, &transport, wrongField)
|
||||||
|
|
||||||
if !wrongField {
|
if !wrongField {
|
||||||
require.Equal(t, n, result.FieldK)
|
require.Equal(t, n, result.FieldK)
|
||||||
|
|
Loading…
Reference in a new issue