Skip to content

Vlang modules #17724

Mar 21, 2023 · 8 comments · 6 replies
Discussion options

You must be logged in to vote

Use modules instead of mod and add v.mod, and it works correctly.

.
├── modules
│   ├── a
│   │   └── a.v
│   └── b
│       └── b.v
├── src
│   └── mian.v
└── v.mod

modules/a/a.v:

module a

pub fn a() {
        println('a')
}

modules/b/b.v

module b

pub fn b() {
        println('b')
}

src/mian.v

import a
import b

fn main() {
        a.a()
        b.b()
}

v.mod is an empty file.

Running this code:

$ v run .
a
b
$

Replies: 8 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@1325500477
Comment options

Comment options

You must be logged in to vote
2 replies
@1325500477
Comment options

@JalonSolov
Comment options

Answer selected by 1325500477
Comment options

You must be logged in to vote
1 reply
@1325500477
Comment options

Comment options

You must be logged in to vote
1 reply
@JalonSolov
Comment options

Comment options

You must be logged in to vote
1 reply
@1325500477
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants