From f413c92f2f03fe4b16816e3728087d1f37ab852b Mon Sep 17 00:00:00 2001 From: zakuro Date: Thu, 21 Jan 2021 20:24:32 +0900 Subject: [PATCH] v.util: fix bug of mod_path_to_full_name (#8236) --- vlib/v/util/module.v | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vlib/v/util/module.v b/vlib/v/util/module.v index 5d65522138..308803be3d 100644 --- a/vlib/v/util/module.v +++ b/vlib/v/util/module.v @@ -90,18 +90,17 @@ pub fn mod_path_to_full_name(mod string, path string) ?string { if ls := os.ls(parent) { // currently CI clones some modules into the v repo to test, the condition // after `'v.mod' in ls` can be removed once a proper solution is added - if try_path_parts.len <= i { - continue - } - if 'v.mod' in ls && try_path_parts[i] != 'v' && 'vlib' !in ls { + if 'v.mod' in ls && + (try_path_parts.len > i && try_path_parts[i] != 'v' && 'vlib' !in ls) + { last_v_mod = j - continue } + continue } break } if last_v_mod > -1 { - mod_full_name := try_path_parts[last_v_mod - 1..].join('.') + mod_full_name := try_path_parts[last_v_mod..].join('.') return mod_full_name } }