mirror of
https://github.com/goodhosts/hostsfile.git
synced 2026-04-27 07:25:53 +03:00
[PR #37] [MERGED] When removing a hostname results in an IP without hostname, delete the IP as well #44
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hostsfile#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/goodhosts/hostsfile/pull/37
Author: @kaespi
Created: 4/9/2022
Status: ✅ Merged
Merged: 9/27/2022
Merged by: @luthermonson
Base:
main← Head:remove-by-hostname-deletes-ip-if-needed📝 Commits (1)
3918b47When removing a hostname results in an IP without hostname, delete the IP as well📊 Changes
2 files changed (+60 additions, -6 deletions)
View changed files
📝
hosts.go(+34 -6)📝
hosts_test.go(+26 -0)📄 Description
I've noticed that when I delete a hostname using
RemoveByHostname()I get lines in the hosts file which don't have a hostname, i.e. just an IP address. I think that's first of all not allowed and second doesn't make sense at all. Hence, I propose to remove the corresponding line completely when callingRemoveByHostname()removes the only hostname on a line.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.