Skip to content

Fix/panic#12

Open
panaC wants to merge 2 commits into
edrlab:mainfrom
panaC:fix/panic
Open

Fix/panic#12
panaC wants to merge 2 commits into
edrlab:mainfrom
panaC:fix/panic

Conversation

@panaC

@panaC panaC commented Jun 15, 2026

Copy link
Copy Markdown
Member

Fixes #11

cc @llemeurfr

@panaC

panaC commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

In Go, a slice already behaves like a small reference-like value.
A []stor.Publication is a header containing:

  • pointer to array
  • length
  • capacity

So passing or returning a slice copies only that small header, not the whole publication array. That means *[]stor.Publication usually gives no useful performance benefit.
I don't think any mutation of the publication slice pointer is required here. Maybe I'm wrong.

@panaC

panaC commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Add a pointer to the slice is more risky as it can carry a NULL reference

@panaC

panaC commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Overall, I think Go main weakness is the lack of borrow checker, which makes this kind of error possible. I'm afraid there is no compile-time static checker to catch it.

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.

PANIC sigsegv on TestSearchPublications

1 participant