diff options
author | Catalin Ancutei <37979489+Catalyn45@users.noreply.github.com> | 2024-03-18 01:01:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 10:01:00 +1100 |
commit | 4b076d199b6d98c88483c5fecd5b48f23f6318a4 (patch) | |
tree | 24e106fab7888bdd4075bb918aa996cafae4be23 | |
parent | d2136df5384ad320c71156c0aba52a84dd704c03 (diff) |
Fixed tags on windows (#1646)
* Fixed tags on windows
* Use the variable text directly in error message
-rw-r--r-- | nav.go | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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 } |