[GH-ISSUE #38] Regression - panic when calling Clear and then Add #11

Closed
opened 2026-03-02 05:08:06 +03:00 by kerem · 0 comments
Owner

Originally created by @guscott on GitHub (May 3, 2022).
Original GitHub issue: https://github.com/goodhosts/hostsfile/issues/38

Version: 0.1.1

When calling Hosts.Clear() to remove lines from the hosts file and then regenerating the file with Hosts.Add cause a panic on this line:
hostsCopy := h.Lines[position[0]].Hosts because position[0] use the new lookup.

When calling Hosts.Clear, it should also clear the lookup information.

This was working on version 0.0.8.

Originally created by @guscott on GitHub (May 3, 2022). Original GitHub issue: https://github.com/goodhosts/hostsfile/issues/38 Version: 0.1.1 When calling Hosts.Clear() to remove lines from the hosts file and then regenerating the file with Hosts.Add cause a panic on this line: `hostsCopy := h.Lines[position[0]].Hosts` because `position[0]` use the new lookup. When calling Hosts.Clear, it should also clear the lookup information. This was working on version 0.0.8.
kerem closed this issue 2026-03-02 05:08:06 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hostsfile#11
No description provided.