Skip to content

Commit

Permalink
Merge pull request hyperledger-archives#9 from dplumb94/fix-protobufs
Browse files Browse the repository at this point in the history
Fix unkeyed literals in protobuf initialization
  • Loading branch information
dplumb94 authored May 1, 2018
2 parents 13a372c + 3acfd5a commit 8422a91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion processor/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ func (self *Context) AddReceiptData(data []byte) error {
func (self *Context) AddEvent(event_type string, attributes []Attribute, event_data []byte) error {
event_attributes := make([]*events_pb2.Event_Attribute, 0, len(attributes))
for _, attribute := range attributes {
event_attributes = append(event_attributes, &events_pb2.Event_Attribute{attribute.Key, attribute.Value})
event_attributes = append(
event_attributes,
&events_pb2.Event_Attribute{
Key: attribute.Key,
Value: attribute.Value,
},
)
}

event := &events_pb2.Event{
Expand Down
8 changes: 7 additions & 1 deletion tests/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ func TestAddEvent(t *testing.T) {
context := processor.NewContext(connection, "asdf")

event_attributes := make([]*events_pb2.Event_Attribute, 0)
event_attributes = append(event_attributes, &events_pb2.Event_Attribute{"key", "value"})
event_attributes = append(
event_attributes,
&events_pb2.Event_Attribute{
Key: "key",
Value: "value",
},
)

event := &events_pb2.Event{
EventType: "test",
Expand Down

0 comments on commit 8422a91

Please sign in to comment.