Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V seems to expect all sources to be located under src folder #19763

Closed
slavaschmidt opened this issue Nov 4, 2023 · 1 comment
Closed

V seems to expect all sources to be located under src folder #19763

slavaschmidt opened this issue Nov 4, 2023 · 1 comment
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@slavaschmidt
Copy link

slavaschmidt commented Nov 4, 2023

Describe the bug

It seems only possible to compile a project if sources are located directly in the src folder. For example, it is impossible to use a standard maven layout or other conventional project structures.

Reproduction Steps

~/tmp$ v new
Input your project name: test
Input your project description:
Input your project version: (0.0.0)
Input your project license: (MIT)
Initialising ...
Complete!

~/tmp$ cd test

~/tmp/test$ v run .
Hello World!

~/tmp/test$ mkdir src/v

~/tmp/test$ mv src/main.v src/v/

~/tmp/test$ v run .
No input .v files

Expected Behavior

main.v is found despite being located in the subfolder

Current Behavior

v can't find sources as soon as they are moved into the sub-folder

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.2 0b58a4d

Environment details (OS name and version, etc.)

Darwin supersonic.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 arm64

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@slavaschmidt slavaschmidt added the Bug This tag is applied to issues which reports bugs. label Nov 4, 2023
@spytheman
Copy link
Member

spytheman commented Nov 4, 2023

You can put your .v files directly in your project folder, or in a src/ folder.
Putting them in src/v/, means that they will be part of a v module, not part of your main project, i.e. when in a folder project/ (that has in it project/v.mod), then v . will work with both project/main.v and with project/src/main.v, but not with project/src/v/main.v .

V can not accommodate all possible conventions for laying out files. It supports just 2.

See also https://github.com/vlang/v/blob/master/doc/docs.md#modules .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants