modules are broken
V version: V 0.1.18 (latest commit: https://github.com/vlang/v/commit/ad32a3770bfee9ee5ffe9152a80e49bbb94d41d4) OS: Arch Linux
Description Modules are currently not working. When I try to create the example module, this fails:
// mymodule.v
module mymodule
// To export a function we have to use `pub`
pub fn say_hi() {
println('hello from mymodule!')
}
I am compiling this with v -lib ./mymodule
It will give an error of this kind:
/home/bowero/Documents/mymodule/mymodule.v:4:14: redefinition of `mymodule.say_hi`
This seems to happen with every module and even empty modules will give an error.
panic: function `main` is undeclared in the main module
Thanks to the efforts of @Henrixounez, the problem has been found.
The v -lib ./mymodule structure has been abandoned for v build module ./mymodule/. The / at the end of the command is very important.
This will work:
v build module ./mymodule/v build module mymodule/
This will not work:
v build module ./mymodulev build module mymodule
I've updated the docs.
Will fix the slash issue.