-
Notifications
You must be signed in to change notification settings - Fork 503
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
Duplicate module #2550
Comments
A circular import is when, for example, a imports b which imports a again. This is a duplicate definition. You could work around it by importing We already have |
Thanks for the clarification re the circular import. I redid my approach - I was thinking in an Ansible-esque way and was making things too complicated. What also tripped me up was that I found I couldn't work out the difference between modules and imports. After reading the docs I came away unclear which method would be used when. Otherwise great work on a excellent tool! One supplementary question - I'm now using modules and am looking to hide these from a |
I agree that there is a lot of duplication between modules and imports. Imports work by conceptually inserting the referenced file into the current file. So you get a Modules create a new namespace which contains the recipes of the referenced files. So you can call them on the command line with |
This isn't currently possible, but seems reasonable to: #2561. |
I have the following layout:
$ tree
myproject
├── installs
│ ├── neovim.just
│ ├── ripgrep.just
│ ├── traceroute.just
│ └── xclip.just
├── JUSTFILE
├── modules
│ ├── apt.just
│ └── curl.just
Where my intention was for each of the just files under myproject/installs/ to be runnable either standalone or from the root level myproject/JUSTFILE.
The myproject/modules/*.just files have common behaviour that was to be called from anywhere.
If we look at the various files:
The root level JUSTFILE
One of the ../install files (the xclip just file is identical to the below save for the name)
And lastly one of the modules
This arrangement yields this error
Which I'm guessing is a circular import.
Is this expected behaviour?
I can get it to work by removing the
mod apt "modules/apt.just"
import from the installs/*.just files and placing it within the root level JUSTFILE but this kills the modularity I was going for.
So am I doing it wrong and I have to rethink my approach or can I get around the circular import?
The text was updated successfully, but these errors were encountered: