Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/load: support loading a CUE package whose directory ends with .cue
When we load a CUE instance, we need to traverse the chain of parent directories up to the module root to potentially load parent packages with the same package name, if there are any. As such, we need to parse any CUE files in parent directories. If we are using cue/load to load a CUE package in a directory whose name looks like a CUE file, this would work with older CUE versions like v0.7.1, but it fails on newer ones like v0.11.0. This is because the new logic brought in with CUE_EXPERIMENT=modules read and parsed all files from parent directories with a ".cue" extension, regardless of whether they were a directory or not. The old code before CUE_EXPERIMENT=modules used IsDir to filter out directories, presumably because package directory names such as taxes.cue from https://github.com/tmm1/taxes.cue do happen. Do the same in the new code, which is easy enough. The test is added in the very same commit, and not in a previous one, because the mere addition of the testdir.cue testdata directory causes all other tests, which load parent directories, to also fail. Fixes #3592. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I10bc05c1f821444bd913e6fc694b3194efb6da8b Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1204614 Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
- Loading branch information