From cfbf667389d952a5a9831fb3ac1375d76691264c Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Tue, 5 Dec 2023 23:10:48 +0000 Subject: [PATCH] Fix Entry.go wrong way round arguments. --- README.md | 2 +- hosts/Entry.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e0706ef..1f00e57 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This allows for hosts specified in a host formatted file to be synced to the act The .env file is used to configure the hosts file to use a source (SOURCE_FILE) to be synced to the actual file (HOSTS_FILE). There is the ability to overwrite existing values as part of sync, so long as the domain is the only one defined on the line (HOSTS_OVERWRITE = 1). -There is the ability to periodic sync with a specified interval (SYNC_TIME). +There is the ability to periodic sync with a specified interval in milliseconds (SYNC_TIME). Maintainer: [Captain ALM](https://code.mrmelon54.com/alfred) diff --git a/hosts/Entry.go b/hosts/Entry.go index 48cd514..e97583c 100644 --- a/hosts/Entry.go +++ b/hosts/Entry.go @@ -5,7 +5,7 @@ import "strings" func NewHostsEntry(lineIn string) Entry { trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ") lineSplt := strings.Split(trLineIn, " ") - if strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") { + if strings.HasPrefix(strings.TrimPrefix(trLineIn, " "), "#") { return Entry{ IPAddress: "", Domains: nil, @@ -17,7 +17,7 @@ func NewHostsEntry(lineIn string) Entry { if lineSplt[i] == "" { continue } - if strings.HasPrefix(strings.TrimPrefix(" ", lineSplt[i]), "#") { + if strings.HasPrefix(lineSplt[i], "#") { break } theDomains = append(theDomains, lineSplt[i])