summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Ancutei <37979489+Catalyn45@users.noreply.github.com>2024-03-18 01:01:00 +0200
committerGitHub <noreply@github.com>2024-03-18 10:01:00 +1100
commit4b076d199b6d98c88483c5fecd5b48f23f6318a4 (patch)
tree24e106fab7888bdd4075bb918aa996cafae4be23
parentd2136df5384ad320c71156c0aba52a84dd704c03 (diff)
Fixed tags on windows (#1646)
* Fixed tags on windows * Use the variable text directly in error message
-rw-r--r--nav.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/nav.go b/nav.go
index 3178800..d6014fe 100644
--- a/nav.go
+++ b/nav.go
@@ -1926,10 +1926,15 @@ func (nav *nav) readTags() error {
scanner := bufio.NewScanner(f)
for scanner.Scan() {
- path, tag, found := strings.Cut(scanner.Text(), ":")
- if !found {
- return fmt.Errorf("invalid tags file entry: %s", scanner.Text())
+ text := scanner.Text()
+
+ ind := strings.LastIndex(text, ":")
+ if ind == -1 {
+ return fmt.Errorf("invalid tags file entry: %s", text)
}
+
+ path := text[0:ind]
+ tag := text[ind+1:]
if _, ok := nav.tags[path]; !ok {
nav.tags[path] = tag
}