Fix Entry.go wrong way round arguments.

This commit is contained in:
Captain ALM 2023-12-05 23:10:48 +00:00
parent b701669648
commit cfbf667389
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
2 changed files with 3 additions and 3 deletions

View File

@ -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). 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 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: Maintainer:
[Captain ALM](https://code.mrmelon54.com/alfred) [Captain ALM](https://code.mrmelon54.com/alfred)

View File

@ -5,7 +5,7 @@ import "strings"
func NewHostsEntry(lineIn string) Entry { func NewHostsEntry(lineIn string) Entry {
trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ") trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ")
lineSplt := strings.Split(trLineIn, " ") lineSplt := strings.Split(trLineIn, " ")
if strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") { if strings.HasPrefix(strings.TrimPrefix(trLineIn, " "), "#") {
return Entry{ return Entry{
IPAddress: "", IPAddress: "",
Domains: nil, Domains: nil,
@ -17,7 +17,7 @@ func NewHostsEntry(lineIn string) Entry {
if lineSplt[i] == "" { if lineSplt[i] == "" {
continue continue
} }
if strings.HasPrefix(strings.TrimPrefix(" ", lineSplt[i]), "#") { if strings.HasPrefix(lineSplt[i], "#") {
break break
} }
theDomains = append(theDomains, lineSplt[i]) theDomains = append(theDomains, lineSplt[i])