Skip to content

Commit

Permalink
Fix lint warning
Browse files Browse the repository at this point in the history
A double pointer is needed here to pass through null as nil.
  • Loading branch information
kbolino committed Jul 29, 2024
1 parent 66e0b2e commit 3730478
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions encoding/geojson/geojson.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,18 +493,10 @@ func Marshal(g geom.T, opts ...EncodeGeometryOption) ([]byte, error) {

// Unmarshal unmarshalls a []byte to an arbitrary geometry.
func Unmarshal(data []byte, g *geom.T) error {
if bytes.Equal(data, nullGeometry) {
*g = nil
return nil
}
// FIXME The following lint error is suppressed, but there is probably a genuine error here
//
//nolint:staticcheck
gg := &Geometry{}
if err := json.Unmarshal(data, gg); err != nil {
if err := json.Unmarshal(data, &gg); err != nil {
return err
}
//nolint:staticcheck
if gg == nil {
*g = nil
return nil
Expand Down

0 comments on commit 3730478

Please sign in to comment.