[GH-ISSUE #8] Comments are not published on Flush #3

Closed
opened 2026-03-02 05:08:02 +03:00 by kerem · 1 comment
Owner

Originally created by @ShivalikRanaut on GitHub (Jun 8, 2020).
Original GitHub issue: https://github.com/goodhosts/hostsfile/issues/8

Hi with the new update , Comments are not published
func (l *HostsLine) ToRaw() string {
var comment string
if l.Comment != "" {
comment = fmt.Sprintf(" %s%s", commentChar, l.Comment)
}

return fmt.Sprintf("%s %s%s", l.IP, strings.Join(l.Hosts, " "), comment)

}`

can be changed to

`func (l *HostsLine) ToRaw() string {
if l.IsComment() {
return l
}
var comment string
if l.Comment != "" {
comment = fmt.Sprintf(" %s%s", commentChar, l.Comment)
}

return fmt.Sprintf("%s %s%s", l.IP, strings.Join(l.Hosts, " "), comment)

}`

Originally created by @ShivalikRanaut on GitHub (Jun 8, 2020). Original GitHub issue: https://github.com/goodhosts/hostsfile/issues/8 Hi with the new update , Comments are not published `func (l *HostsLine) ToRaw() string { ` var comment string if l.Comment != "" { comment = fmt.Sprintf(" %s%s", commentChar, l.Comment) } return fmt.Sprintf("%s %s%s", l.IP, strings.Join(l.Hosts, " "), comment) }` can be changed to `func (l *HostsLine) ToRaw() string { if l.IsComment() { return l } var comment string if l.Comment != "" { comment = fmt.Sprintf(" %s%s", commentChar, l.Comment) } return fmt.Sprintf("%s %s%s", l.IP, strings.Join(l.Hosts, " "), comment) }`
kerem closed this issue 2026-03-02 05:08:02 +03:00
Author
Owner

@ShivalikRanaut commented on GitHub (Jun 8, 2020):

I have added a pull request for the same https://github.com/goodhosts/hostsfile/pull/9/commits

<!-- gh-comment-id:640696629 --> @ShivalikRanaut commented on GitHub (Jun 8, 2020): I have added a pull request for the same https://github.com/goodhosts/hostsfile/pull/9/commits
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#3
No description provided.