Saving place.Units as byte array instead of trying any encoding

This commit is contained in:
mariusor 2022-01-26 15:24:39 +01:00
parent a14c77aac8
commit 8f025c2e36
No known key found for this signature in database
GPG key ID: DBF5E47F5DBC4D21
2 changed files with 2 additions and 11 deletions

View file

@ -26,11 +26,6 @@ func gobDecodeInt64(i *int64, data []byte) error {
return g.Decode(i)
}
func gobDecodeString(s *string, data []byte) error {
g := gob.NewDecoder(bytes.NewReader(data))
return g.Decode(s)
}
func gobDecodeBool(b *bool, data []byte) error {
g := gob.NewDecoder(bytes.NewReader(data))
return g.Decode(b)
@ -647,9 +642,7 @@ func unmapPlaceProperties(mm map[string][]byte, p *Place) error {
}
}
if raw, ok := mm["units"]; ok {
if err = gobDecodeString(&p.Units, raw); err != nil {
return err
}
p.Units = string(raw)
}
return nil
}

View file

@ -679,9 +679,7 @@ func mapPlaceProperties(mm map[string][]byte, p Place) (hasData bool, err error)
hasData = true
}
if len(p.Units) > 0 {
if mm["units"], err = gobEncodeBytes([]byte(p.Units)); err != nil {
return
}
mm["units"] = []byte(p.Units)
hasData = true
}
return