Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some small issues that were flagged by upcoming lint checks. #138

Merged
merged 3 commits into from
Apr 3, 2025

Conversation

rsned
Copy link
Collaborator

@rsned rsned commented Apr 2, 2025

No description provided.

s2/shapeindex.go Outdated
@@ -1466,7 +1466,7 @@ func (s *ShapeIndex) absorbIndexCell(p *PaddedCell, iter *ShapeIndexIterator, ed
}

// Update the edge list and delete this cell from the index.
edges, newEdges = newEdges, edges
edges, newEdges = newEdges, edges //nolint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the lint check being disabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's complaining about the swap of pointers.
s2/shapeindex.go:1469:9: ineffectual assignment to newEdges (ineffassign)
edges, newEdges = newEdges, edges
^

i.e. https://github.com/google/s2geometry/blob/master/src/s2/mutable_s2shape_index.cc#L1670

at the end of absorb cell we swap the new edges with the existing for the return leaving the one swapped out as dangling here.

it seems to compile and run ok if I do a, _= b, a though it's not clear if that leaves a loose pointer around.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this saying that edges and newEdges aren't used after this? Should the argument be a pointer to a slice?

Tests in C++ fail if I delete the corresponding line, but not in Go.

I would leave the lint error for now and add a TODO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added todo.

@rsned rsned merged commit b4895f7 into golang:master Apr 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants