encoding/protobuf: enforce loading builting packages
For now it loads all. This avoids renumbering (confusing
while debugging) and potential other misses.
Fixes #635
Change-Id: I8dd67f023a2c3667e9af4f530cd51c6f28206f2b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8232
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/protobuf/protobuf.go b/encoding/protobuf/protobuf.go
index 5ce0505..456a19b 100644
--- a/encoding/protobuf/protobuf.go
+++ b/encoding/protobuf/protobuf.go
@@ -100,6 +100,15 @@
"cuelang.org/go/cue/parser"
"cuelang.org/go/cue/token"
"cuelang.org/go/internal"
+
+ // Generated protobuf CUE may use builtins. Ensure that these can always be
+ // found, even if the user does not use cue/load or another package that
+ // triggers its loading.
+ //
+ // TODO: consider whether just linking in the necessary packages suffices.
+ // It probably does, but this may reorder some of the imports, which may,
+ // in turn, change the numbering, which can be confusing while debugging.
+ _ "cuelang.org/go/pkg"
)
// Config specifies the environment into which to parse a proto definition file.