Skip to content

Commit

Permalink
format some code
Browse files Browse the repository at this point in the history
  • Loading branch information
alovak committed Feb 14, 2022
1 parent 537511e commit 14ecbbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ func (m *Message) MarshalJSON() ([]byte, error) {

fieldMap := m.GetFields()
strFieldMap := map[string]field.Field{}
for k, v := range fieldMap {
for id, field := range fieldMap {
// we don't wish to populate the bitmap in the final
// JSON since it is dynamically generated when packing
// and unpacking anyways.
if k == bitmapIdx {
if id == bitmapIdx {
continue
}
strFieldMap[fmt.Sprint(k)] = v
strFieldMap[fmt.Sprint(id)] = field
}

// get only fields that were set
Expand Down Expand Up @@ -253,7 +253,7 @@ func (m *Message) packableFieldIDs() ([]int, error) {
// Index 1 represent bitmap which is always populated.
populatedFieldIDs := []int{1}

for id, _ := range m.fieldsMap {
for id := range m.fieldsMap {
// represents the bitmap
if id == 1 {
continue
Expand Down
1 change: 0 additions & 1 deletion message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func TestMessage(t *testing.T) {
}

message := NewMessage(spec)
message.SetData(&ISO87Data{})

rawMsg := []byte("01007000000000000000164242424242424242123456000000000100")
err := message.Unpack([]byte(rawMsg))
Expand Down

0 comments on commit 14ecbbf

Please sign in to comment.