Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/load: do not scan imports of non-CUE files
The recent fix to do better with imports in command-line-specified files (https://cuelang.org/cl/1194765) changed cue/load to scan imports before loading files. It scans imports in all files including non-CUE files. This turns out to be a problem because the code to get the CUE syntax in turn invokes the internal/encoding.Decoder logic which requires a fully populated encoding.Config struct in order to do its job properly. Specifically, the encoding.Config created by cue/load does not have the protobuf import path required when decoding protobuf files, so this was failing. Work around this by scanning imports of CUE files only, mirroring the same logic in cue/load.matchFile. In the future, we will probably have to rework this, as it's entirely possible that non-CUE specified on the command line might end up producing a CUE representation that imports external CUE packages, but for now this should be sufficient. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I703b7c1f95be253070792d7744589474ce88ad7a Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194827 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information