Просмотр исходного кода

runtime: expose protoimpl and protolegacy

The internal/impl and internal/legacy packages are only visible from packages
within the v2 repository. However, selected parts of these packages need to
be visible from the v1 repository or from generated code.

Change-Id: I1d87227dacc38f5b1ac464e9b9dd43bd34559cda
Reviewed-on: https://go-review.googlesource.com/c/151858
Reviewed-by: Herbie Ong <herbie@google.com>
Joe Tsai 7 лет назад
Родитель
Сommit
f9123a3cd0
2 измененных файлов с 34 добавлено и 0 удалено
  1. 18 0
      runtime/protoimpl/impl.go
  2. 16 0
      runtime/protolegacy/legacy.go

+ 18 - 0
runtime/protoimpl/impl.go

@@ -0,0 +1,18 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package protoimpl contains the default implementation for messages
+// generated by protoc-gen-go.
+//
+// WARNING: This package should only ever be imported by generated messages.
+// The compatibility agreement covers nothing except for functionality needed
+// to keep existing generated messages operational. Breakages that occur due
+// to unauthorized usages of this package are not the author's responsibility.
+package protoimpl
+
+import "github.com/golang/protobuf/v2/internal/impl"
+
+var X impl.Export
+
+type MessageType = impl.MessageType

+ 16 - 0
runtime/protolegacy/legacy.go

@@ -0,0 +1,16 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package protolegacy contains the default implementation for messages
+// generated by protoc-gen-go.
+//
+// WARNING: This package should only ever be imported by the v1 proto package.
+// The compatibility agreement covers nothing except for functionality needed
+// to provide v1 interoperability. Breakages that occur due to unauthorized
+// usages of this package are not the author's responsibility.
+package protolegacy
+
+import "github.com/golang/protobuf/v2/internal/legacy"
+
+var X legacy.Export