cue-lang / docs-and-content

A place to discuss, plan, and track documentation on cuelang.org
6 stars 1 forks source link

docs/howto/import-package-main-module-root: Importing a package from a main module root #140

Open jpluscplusm opened 6 months ago

jpluscplusm commented 6 months ago

In https://cuelang.slack.com/archives/C063DSMKS56/p1715002541932389, a user was unable to figure out how to import a package from the root of their main module. They weren't aware of the path:packageId import form.

https://cuelang.org/docs/concept/modules-packages-instances/#import-path does contain enough information to do this, but that page is a relatively long read that has a good chance of being deprecated soon (following the modules proposal's status change to "likely accept").

Given that this is main module related, a howto guide explaining this won't need to get deprecated. And, given that the root of a main module, by definition, never has an importable path that is also a valid package name, this would seem to be a useful guide to publish - this question must be answered by anyone importing a package from the root of a module, no matter the module name.

This could be considered a subset of "how to import a package from a directory when the package name and directory name aren't the same", but there's no harm in potentially publishing both those guides.