Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Update Go sdk to comply with golang/protobuf update #1603

Merged
merged 1 commit into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sdk/go/src/sawtooth_sdk/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 sdk/go/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