Fixed tags on windows (#1646)

* Fixed tags on windows

* Use the variable text directly in error message
This commit is contained in:
Catalin Ancutei authored and GitHub committed 2024-03-18 10:01:00 +11:00
1 parent d2136df538
commit 4b076d199b
1 file changed
+8 -3
+8 -3
View File
@@ -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
}