1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

protoio: Use keyed fields in composite literal

In the protoio tests, we were using unkeyed fields in some composite
literals. This can cause confusion and makes the code more brittle wrt.
future changes. go vet also complains about this.

This patch fixes the issue by adding the field names to the struct
initializations.
This commit is contained in:
Alberto Bertogli
2018-03-02 14:59:27 +00:00
parent f629ffefa4
commit f4fb2153b8

View File

@@ -11,7 +11,7 @@ import (
func TestBin(t *testing.T) {
dir := testlib.MustTempDir(t)
defer testlib.RemoveIfOk(t, dir)
pb := &testpb.M{"hola"}
pb := &testpb.M{Content: "hola"}
if err := WriteMessage("f", pb, 0600); err != nil {
t.Error(err)
@@ -29,7 +29,7 @@ func TestBin(t *testing.T) {
func TestText(t *testing.T) {
dir := testlib.MustTempDir(t)
defer testlib.RemoveIfOk(t, dir)
pb := &testpb.M{"hola"}
pb := &testpb.M{Content: "hola"}
if err := WriteTextMessage("f", pb, 0600); err != nil {
t.Error(err)
@@ -56,7 +56,7 @@ func TestStore(t *testing.T) {
t.Errorf("expected no ids, got %v - %v", ids, err)
}
pb := &testpb.M{"hola"}
pb := &testpb.M{Content: "hola"}
if err := st.Put("f", pb); err != nil {
t.Error(err)