Skip to content

Commit

Permalink
v.utils: fix module lookup if module import parts end with the word `…
Browse files Browse the repository at this point in the history
…modules` (#21083)
  • Loading branch information
ttytm authored Mar 24, 2024
1 parent cf9746d commit f66b595
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
# run: V_CI_CSTRICT=1 ./v -cstrict test-self
- name: Build examples
run: ./v -W build-examples
- name: Run the submodule example, using a relative path
run: ./v -W run examples/submodule
- name: Build v tools
run: ./v -W build-tools
- name: Build v binaries
Expand Down
2 changes: 1 addition & 1 deletion examples/submodule/mymodules/main_functions.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module mymodule
module mymodules

pub fn add_xy(x int, y int) int {
return x + y
Expand Down
3 changes: 2 additions & 1 deletion vlib/v/util/module.v
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ fn mod_path_to_full_name(pref_ &pref.Preferences, mod string, path string) !stri
}
}
mut in_vmod_path := false
parts := path.split(os.path_separator)
for vmod_folder in vmod_folders {
if path.contains(vmod_folder + os.path_separator) {
if vmod_folder in parts {
in_vmod_path = true
break
}
Expand Down

0 comments on commit f66b595

Please sign in to comment.