encoding/protobuf: don't require google/protobuf files on disk master
Protobuf imports like `google/protobuf/timestamp.proto` are mapped to CUE built-in packages, i.e. standard library packages, such that e.g. google.protobuf.Timestamp becomes CUE's time.Time. The code was written in a way where the file had to exist on disk under one of the directories configured via Config.Paths. This is entirely unnecessary, as we don't read nor parse the files in any way when we are mapping them to the CUE standard library. Allow these mapped files to not exist on disk. While here, it was noted that we had two ways to detect the "import not found" error case, with one being redundant. Remove the one inside mapBuiltinPackage, and simplify the function so that it simply returns "true" when it finds a mapped package. As a regression test, given that we already have testdata proto files which import google/protobuf via "testdata" being in the search path, what we can simply do is delete those bundled files. I have verified that multiple tests break without the testdata files and without the fix. Fixes #4033. Closes #4034 as merged as of commit 1ac40b63. Co-authored-by: Daniel Martí <mvdan@mvdan.cc> Signed-off-by: Julian Early <julian@chalk.ai> Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I482fd3a6d15dfc8dde7e2ddac91667783ae40017 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1221533 Reviewed-by: Roger Peppe <rogpeppe@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>