internal/proto: move location of cue/cue.proto
This makes cuelang.org/cue/encoding/protobuf (git)
the import path and cue/cue.proto the canonical
import name.
Add google files for import, even though the types
are mapped, for better validation.
Change-Id: I8f31102baf362608c50c26f85e810b87321aab94
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2342
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/protobuf/parse.go b/internal/protobuf/parse.go
index 712c42e..0753199 100644
--- a/internal/protobuf/parse.go
+++ b/internal/protobuf/parse.go
@@ -244,7 +244,7 @@
}
func (p *protoConverter) doImport(v *proto.Import) {
- if v.Filename == "cuelang/cue.proto" {
+ if v.Filename == "cue/cue.proto" {
return
}
@@ -259,10 +259,7 @@
break
}
- if filename == "" {
- p.mustBuiltinPackage(v.Position, v.Filename)
- return
- }
+ p.mapBuiltinPackage(v.Position, v.Filename, filename == "")
imp, err := p.state.parse(filename, nil)
if err != nil {
@@ -356,6 +353,9 @@
case *proto.Import:
// already handled.
+ case *proto.Extensions:
+ // no need to handle
+
default:
failf(scanner.Position{}, "unsupported type %T", x)
}
@@ -440,6 +440,9 @@
case *proto.Oneof:
p.oneOf(x)
+ case *proto.Extensions:
+ // no need to handle
+
default:
failf(scanner.Position{}, "unsupported type %T", v)
}