From 4221d1aa4d20ada495771528bb13ca786d0bdbe0 Mon Sep 17 00:00:00 2001
From: Jonathan Hseu <jhseu@google.com>
Date: Wed, 5 Feb 2020 13:07:47 -0800
Subject: [PATCH] Give unique go package paths in core/framework to avoid
 circular dependencies.

PiperOrigin-RevId: 293433590
Change-Id: Ia0dd6ed36cadcf2372805f6a83d5cfb51618db8c
---
 tensorflow/core/example/example.proto         | 10 ++++---
 .../example_parser_configuration.proto        | 21 +++++++-------
 tensorflow/core/example/feature.proto         | 14 ++++++----
 .../framework/allocation_description.proto    |  5 ++--
 tensorflow/core/framework/attr_value.proto    | 10 ++++---
 tensorflow/core/framework/cost_graph.proto    |  8 ++++--
 .../core/framework/device_attributes.proto    |  9 +++---
 tensorflow/core/framework/function.proto      | 10 ++++---
 tensorflow/core/framework/graph.proto         | 12 ++++----
 .../core/framework/graph_transfer_info.proto  | 16 ++++++-----
 tensorflow/core/framework/kernel_def.proto    |  8 ++++--
 tensorflow/core/framework/log_memory.proto    | 16 ++++++-----
 tensorflow/core/framework/node_def.proto      | 10 ++++---
 tensorflow/core/framework/reader_base.proto   |  5 ++--
 .../remote_fused_graph_execute_info.proto     | 13 +++++----
 .../core/framework/resource_handle.proto      | 11 ++++----
 tensorflow/core/framework/step_stats.proto    | 14 ++++++----
 tensorflow/core/framework/summary.proto       | 10 ++++---
 tensorflow/core/framework/tensor.proto        | 12 ++++----
 .../core/framework/tensor_description.proto   | 12 ++++----
 tensorflow/core/framework/tensor_slice.proto  | 11 ++++----
 tensorflow/core/framework/variable.proto      |  3 +-
 tensorflow/core/framework/versions.proto      |  5 ++--
 tensorflow/core/protobuf/autotuning.proto     |  2 +-
 tensorflow/core/protobuf/bfc_memory_map.proto |  2 +-
 tensorflow/core/protobuf/cluster.proto        |  3 +-
 tensorflow/core/protobuf/config.proto         | 16 +++++------
 tensorflow/core/protobuf/control_flow.proto   |  3 +-
 .../core/protobuf/conv_autotuning.proto       |  2 +-
 .../core/protobuf/critical_section.proto      |  3 +-
 tensorflow/core/protobuf/debug.proto          |  3 +-
 tensorflow/core/protobuf/debug_event.proto    |  3 +-
 tensorflow/core/protobuf/device_filters.proto |  3 +-
 .../core/protobuf/device_properties.proto     |  3 +-
 tensorflow/core/protobuf/eager_service.proto  |  2 +-
 tensorflow/core/protobuf/error_codes.proto    |  3 +-
 .../core/protobuf/graph_debug_info.proto      |  3 +-
 tensorflow/core/protobuf/master.proto         | 12 ++++----
 tensorflow/core/protobuf/master_service.proto |  6 ++--
 tensorflow/core/protobuf/meta_graph.proto     | 12 ++++----
 tensorflow/core/protobuf/named_tensor.proto   |  6 ++--
 tensorflow/core/protobuf/queue_runner.proto   |  6 ++--
 .../core/protobuf/remote_tensor_handle.proto  |  3 +-
 tensorflow/core/protobuf/replay_log.proto     |  3 +-
 .../core/protobuf/rewriter_config.proto       |  9 +++---
 tensorflow/core/protobuf/saved_model.proto    |  6 ++--
 .../core/protobuf/saved_object_graph.proto    |  3 +-
 tensorflow/core/protobuf/saver.proto          |  3 +-
 tensorflow/core/protobuf/struct.proto         |  4 +--
 tensorflow/core/protobuf/tensor_bundle.proto  | 12 ++++----
 .../core/protobuf/tensorflow_server.proto     |  2 +-
 tensorflow/core/protobuf/trace_events.proto   |  3 +-
 .../protobuf/trackable_object_graph.proto     |  3 +-
 .../core/protobuf/transport_options.proto     |  2 +-
 .../core/protobuf/verifier_config.proto       |  3 +-
 tensorflow/core/protobuf/worker.proto         | 12 ++++----
 tensorflow/core/protobuf/worker_service.proto |  9 +++---
 tensorflow/go/saved_model.go                  |  7 ++---
 tensorflow/go/signature.go                    |  6 ++--
 tensorflow/go/signature_test.go               | 28 +++++++++----------
 60 files changed, 248 insertions(+), 208 deletions(-)

diff --git a/tensorflow/core/example/example.proto b/tensorflow/core/example/example.proto
index e36e51d8d55..32a1d0b4468 100644
--- a/tensorflow/core/example/example.proto
+++ b/tensorflow/core/example/example.proto
@@ -2,13 +2,15 @@
 // model training or inference.
 syntax = "proto3";
 
+package tensorflow;
+
 import "tensorflow/core/example/feature.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ExampleProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.example";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example";
-package tensorflow;
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto";
 
 // An Example is a mostly-normalized data format for storing data for
 // training and inference.  It contains a key-value store (features); where
@@ -87,7 +89,7 @@ package tensorflow;
 
 message Example {
   Features features = 1;
-};
+}
 
 // A SequenceExample is an Example representing one or more sequences, and
 // some context.  The context contains features which apply to the entire
@@ -298,4 +300,4 @@ message Example {
 message SequenceExample {
   Features context = 1;
   FeatureLists feature_lists = 2;
-};
+}
diff --git a/tensorflow/core/example/example_parser_configuration.proto b/tensorflow/core/example/example_parser_configuration.proto
index b2c115d80e3..0af0f4b44ca 100644
--- a/tensorflow/core/example/example_parser_configuration.proto
+++ b/tensorflow/core/example/example_parser_configuration.proto
@@ -2,38 +2,39 @@
 
 syntax = "proto3";
 
+package tensorflow;
+
+import "tensorflow/core/framework/tensor.proto";
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ExampleParserConfigurationProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.example";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example";
-package tensorflow;
-
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/tensor.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example/example_parser_configuration_go_proto";
 
 message VarLenFeatureProto {
   tensorflow.DataType dtype = 1;
   string values_output_tensor_name = 2;
   string indices_output_tensor_name = 3;
   string shapes_output_tensor_name = 4;
-};
+}
 
 message FixedLenFeatureProto {
   tensorflow.DataType dtype = 1;
   tensorflow.TensorShapeProto shape = 2;
   tensorflow.TensorProto default_value = 3;
   string values_output_tensor_name = 4;
-};
+}
 
 message FeatureConfiguration {
   oneof config {
     FixedLenFeatureProto fixed_len_feature = 1;
     VarLenFeatureProto var_len_feature = 2;
   }
-};
+}
 
 message ExampleParserConfiguration {
   map<string, FeatureConfiguration> feature_map = 1;
-};
+}
diff --git a/tensorflow/core/example/feature.proto b/tensorflow/core/example/feature.proto
index 6d81974aac3..a9496fbdadf 100644
--- a/tensorflow/core/example/feature.proto
+++ b/tensorflow/core/example/feature.proto
@@ -54,12 +54,14 @@
 //
 
 syntax = "proto3";
+
+package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "FeatureProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.example";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example";
-package tensorflow;
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto";
 
 // Containers to hold repeated fundamental values.
 message BytesList {
@@ -80,12 +82,12 @@ message Feature {
     FloatList float_list = 2;
     Int64List int64_list = 3;
   }
-};
+}
 
 message Features {
   // Map from feature name to feature.
   map<string, Feature> feature = 1;
-};
+}
 
 // Containers for sequential data.
 //
@@ -97,9 +99,9 @@ message Features {
 //
 message FeatureList {
   repeated Feature feature = 1;
-};
+}
 
 message FeatureLists {
   // Map from feature name to feature list.
   map<string, FeatureList> feature_list = 1;
-};
+}
diff --git a/tensorflow/core/framework/allocation_description.proto b/tensorflow/core/framework/allocation_description.proto
index 64133b05e18..f18caa40b2b 100644
--- a/tensorflow/core/framework/allocation_description.proto
+++ b/tensorflow/core/framework/allocation_description.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "AllocationDescriptionProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto";
 
 message AllocationDescription {
   // Total number of bytes requested
@@ -25,4 +26,4 @@ message AllocationDescription {
 
   // Address of the allocation.
   uint64 ptr = 6;
-};
+}
diff --git a/tensorflow/core/framework/attr_value.proto b/tensorflow/core/framework/attr_value.proto
index 054e3ec97cc..2e913130dfd 100644
--- a/tensorflow/core/framework/attr_value.proto
+++ b/tensorflow/core/framework/attr_value.proto
@@ -1,14 +1,16 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor.proto";
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "AttrValueProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/tensor.proto";
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto";
 
 // Protocol buffer representing the value for an attr used to configure an Op.
 // Comment indicates the corresponding attr type.  Only the field matching the
diff --git a/tensorflow/core/framework/cost_graph.proto b/tensorflow/core/framework/cost_graph.proto
index cc6bc84d696..68df1932de1 100644
--- a/tensorflow/core/framework/cost_graph.proto
+++ b/tensorflow/core/framework/cost_graph.proto
@@ -1,13 +1,15 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "CostGraphProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto";
 
 message CostGraphDef {
   message Node {
diff --git a/tensorflow/core/framework/device_attributes.proto b/tensorflow/core/framework/device_attributes.proto
index 44236ca9798..4c7a2b87e4f 100644
--- a/tensorflow/core/framework/device_attributes.proto
+++ b/tensorflow/core/framework/device_attributes.proto
@@ -1,21 +1,22 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "DeviceAttributesProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto";
 
 message InterconnectLink {
   int32 device_id = 1;
   string type = 2;
   int32 strength = 3;
-};
+}
 
 message LocalLinks {
   repeated InterconnectLink link = 1;
-};
+}
 
 message DeviceLocality {
   // Optional bus locality of device.  Default value of 0 means
@@ -27,7 +28,7 @@ message DeviceLocality {
 
   // Optional local interconnect links to other devices.
   LocalLinks links = 3;
-};
+}
 
 message DeviceAttributes {
   // Fully specified name of the device within a cluster.
diff --git a/tensorflow/core/framework/function.proto b/tensorflow/core/framework/function.proto
index 71423f9168f..6d43c05f52c 100644
--- a/tensorflow/core/framework/function.proto
+++ b/tensorflow/core/framework/function.proto
@@ -1,14 +1,16 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/attr_value.proto";
+import "tensorflow/core/framework/node_def.proto";
+import "tensorflow/core/framework/op_def.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "FunctionProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/attr_value.proto";
-import "tensorflow/core/framework/node_def.proto";
-import "tensorflow/core/framework/op_def.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/function_go_proto";
 
 // A library is a set of named functions.
 message FunctionDefLibrary {
diff --git a/tensorflow/core/framework/graph.proto b/tensorflow/core/framework/graph.proto
index 76d358971d7..f49e41aa0b0 100644
--- a/tensorflow/core/framework/graph.proto
+++ b/tensorflow/core/framework/graph.proto
@@ -1,14 +1,16 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/function.proto";
+import "tensorflow/core/framework/node_def.proto";
+import "tensorflow/core/framework/versions.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "GraphProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/node_def.proto";
-import "tensorflow/core/framework/function.proto";
-import "tensorflow/core/framework/versions.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_go_proto";
 
 // Represents the graph of operations
 message GraphDef {
@@ -53,4 +55,4 @@ message GraphDef {
   //     consumer does not start until all return values of the callee
   //     function are ready.
   FunctionDefLibrary library = 2;
-};
+}
diff --git a/tensorflow/core/framework/graph_transfer_info.proto b/tensorflow/core/framework/graph_transfer_info.proto
index 232297d460d..febb162cd6a 100644
--- a/tensorflow/core/framework/graph_transfer_info.proto
+++ b/tensorflow/core/framework/graph_transfer_info.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "GraphTransferInfoProto";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/graph_transfer_info_go_proto";
 
 message GraphTransferNodeInput {
   int32 node_id = 1;
@@ -20,22 +22,22 @@ message GraphTransferNodeInfo {
   int32 padding_id = 5;
   int32 input_count = 6;
   int32 output_count = 7;
-};
+}
 message GraphTransferConstNodeInfo {
   string name = 1;
   int32 node_id = 2;
   repeated int64 shape = 3;
   bytes data = 4;
   DataType dtype = 5;
-};
+}
 message GraphTransferNodeInputInfo {
   int32 node_id = 1;
   repeated GraphTransferNodeInput node_input = 2;
-};
+}
 message GraphTransferNodeOutputInfo {
   int32 node_id = 1;
   repeated int32 max_byte_size = 2;
-};
+}
 message GraphTransferGraphInputNodeInfo {
   string name = 1;
   repeated int64 shape = 2;
@@ -66,4 +68,4 @@ message GraphTransferInfo {
   repeated GraphTransferGraphOutputNodeInfo graph_output_node_info = 6;
   // Destination of graph transfer
   Destination destination = 7;
-};
+}
diff --git a/tensorflow/core/framework/kernel_def.proto b/tensorflow/core/framework/kernel_def.proto
index 358621dc0f5..44575d93666 100644
--- a/tensorflow/core/framework/kernel_def.proto
+++ b/tensorflow/core/framework/kernel_def.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/attr_value.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "KernelDefProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/attr_value.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/kernel_def_go_proto";
 
 message KernelDef {
   // Must match the name of an Op.
@@ -43,4 +45,4 @@ message KernelDef {
 // A collection of KernelDefs
 message KernelList {
   repeated KernelDef kernel = 1;
-};
+}
diff --git a/tensorflow/core/framework/log_memory.proto b/tensorflow/core/framework/log_memory.proto
index 7f37eadc3be..7ead0dd94cb 100644
--- a/tensorflow/core/framework/log_memory.proto
+++ b/tensorflow/core/framework/log_memory.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor_description.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "LogMemoryProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/tensor_description.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/log_memory_go_proto";
 
 message MemoryLogStep {
   // Process-unique step id.
@@ -14,7 +16,7 @@ message MemoryLogStep {
 
   // Handle describing the feeds and fetches of the step.
   string handle = 2;
-};
+}
 
 message MemoryLogTensorAllocation {
   // Process-unique step id.
@@ -26,7 +28,7 @@ message MemoryLogTensorAllocation {
 
   // Allocated tensor details.
   TensorDescription tensor = 3;
-};
+}
 
 message MemoryLogTensorDeallocation {
   // Id of the tensor buffer being deallocated, used to match to a
@@ -35,7 +37,7 @@ message MemoryLogTensorDeallocation {
 
   // Name of the allocator used.
   string allocator_name = 2;
-};
+}
 
 message MemoryLogTensorOutput {
   // Process-unique step id.
@@ -71,7 +73,7 @@ message MemoryLogRawAllocation {
 
   // Name of the allocator used.
   string allocator_name = 6;
-};
+}
 
 message MemoryLogRawDeallocation {
   // Process-unique step id.
@@ -90,4 +92,4 @@ message MemoryLogRawDeallocation {
   // True if the deallocation is queued and will be performed later,
   // e.g. for GPU lazy freeing of buffers.
   bool deferred = 5;
-};
+}
diff --git a/tensorflow/core/framework/node_def.proto b/tensorflow/core/framework/node_def.proto
index 3c89f789916..c0dc6836977 100644
--- a/tensorflow/core/framework/node_def.proto
+++ b/tensorflow/core/framework/node_def.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/attr_value.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "NodeProto";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/attr_value.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/node_def_go_proto";
 
 message NodeDef {
   // The name given to this operator. Used for naming inputs,
@@ -79,8 +81,8 @@ message NodeDef {
     // `original_node_names` can be used to map errors originating at the
     // current ndoe to some top level source code.
     repeated string original_func_names = 2;
-  };
+  }
 
   // This stores debug information associated with the node.
   ExperimentalDebugInfo experimental_debug_info = 6;
-};
+}
diff --git a/tensorflow/core/framework/reader_base.proto b/tensorflow/core/framework/reader_base.proto
index 9e187cfa791..6fae310248d 100644
--- a/tensorflow/core/framework/reader_base.proto
+++ b/tensorflow/core/framework/reader_base.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ReaderBaseProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/reader_base_go_proto";
 
 // For serializing and restoring the state of ReaderBase, see
 // reader_base.h for details.
@@ -14,4 +15,4 @@ message ReaderBaseState {
   int64 work_finished = 2;
   int64 num_records_produced = 3;
   bytes current_work = 4;
-};
+}
diff --git a/tensorflow/core/framework/remote_fused_graph_execute_info.proto b/tensorflow/core/framework/remote_fused_graph_execute_info.proto
index 10072724d2f..05f1052f0e0 100644
--- a/tensorflow/core/framework/remote_fused_graph_execute_info.proto
+++ b/tensorflow/core/framework/remote_fused_graph_execute_info.proto
@@ -1,20 +1,21 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/graph.proto";
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "RemoteFusedGraphExecuteInfoProto";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/graph.proto";
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/remote_fused_graph_execute_info_go_proto";
 
 // Protocol buffer representing a handle to a tensorflow resource. Handles are
 // not valid across executions, but can be serialized back and forth from within
 // a single run.
 message RemoteFusedGraphExecuteInfo {
-
   message TensorShapeTypeProto {
     DataType dtype = 1;
     TensorShapeProto shape = 2;
@@ -44,4 +45,4 @@ message RemoteFusedGraphExecuteInfo {
   // TODO(satok): Remote output tensor shape once shape information is stored
   // in NodeDef
   repeated TensorShapeTypeProto default_graph_output_tensor_shape = 7;
-};
+}
diff --git a/tensorflow/core/framework/resource_handle.proto b/tensorflow/core/framework/resource_handle.proto
index 4a03fc7589d..b3c6608b38f 100644
--- a/tensorflow/core/framework/resource_handle.proto
+++ b/tensorflow/core/framework/resource_handle.proto
@@ -1,14 +1,15 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ResourceHandle";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/resource_handle_go_proto";
 
 // Protocol buffer representing a handle to a tensorflow resource. Handles are
 // not valid across executions, but can be serialized back and forth from within
@@ -39,4 +40,4 @@ message ResourceHandleProto {
 
   // Data types and shapes for the underlying resource.
   repeated DtypeAndShape dtypes_and_shapes = 6;
-};
+}
diff --git a/tensorflow/core/framework/step_stats.proto b/tensorflow/core/framework/step_stats.proto
index f8cab135aba..762487f0254 100644
--- a/tensorflow/core/framework/step_stats.proto
+++ b/tensorflow/core/framework/step_stats.proto
@@ -1,13 +1,15 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/allocation_description.proto";
+import "tensorflow/core/framework/tensor_description.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "StepStatsProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/allocation_description.proto";
-import "tensorflow/core/framework/tensor_description.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/step_stats_go_proto";
 
 // An allocation/de-allocation operation performed by the allocator.
 message AllocationRecord {
@@ -36,7 +38,7 @@ message AllocatorMemoryUsed {
 message NodeOutput {
   int32 slot = 1;
   TensorDescription tensor_description = 3;
-};
+}
 
 // For memory tracking.
 message MemoryStats {
@@ -72,7 +74,7 @@ message NodeExecStats {
   int64 op_end_rel_nanos = 15;
   int64 all_end_rel_nanos = 16;
   int64 scheduled_nanos = 17;
-};
+}
 
 message DeviceStepStats {
   string device = 1;
@@ -83,4 +85,4 @@ message DeviceStepStats {
 
 message StepStats {
   repeated DeviceStepStats dev_stats = 1;
-};
+}
diff --git a/tensorflow/core/framework/summary.proto b/tensorflow/core/framework/summary.proto
index b6e4aaf6331..aa2b4edb5ef 100644
--- a/tensorflow/core/framework/summary.proto
+++ b/tensorflow/core/framework/summary.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "SummaryProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/tensor.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto";
 
 // Metadata associated with a series of Summary data
 message SummaryDescription {
@@ -31,7 +33,7 @@ message HistogramProto {
   //   i != 0:  bucket_limit(i-1) .. bucket_limit(i)
   repeated double bucket_limit = 6 [packed = true];
   repeated double bucket = 7 [packed = true];
-};
+}
 
 // A SummaryMetadata encapsulates information on which plugins are able to make
 // use of a certain summary value.
@@ -59,7 +61,7 @@ message SummaryMetadata {
   // imposes constraints on the dtype and shape of the corresponding tensor
   // values. See `DataClass` docs for details.
   DataClass data_class = 4;
-};
+}
 
 enum DataClass {
   // Unknown data class, used (implicitly) for legacy data. Will not be
diff --git a/tensorflow/core/framework/tensor.proto b/tensorflow/core/framework/tensor.proto
index 55921af1d0f..47b694f4361 100644
--- a/tensorflow/core/framework/tensor.proto
+++ b/tensorflow/core/framework/tensor.proto
@@ -1,14 +1,16 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/resource_handle.proto";
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "TensorProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/resource_handle.proto";
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/types.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto";
 
 // Protocol buffer representing a tensor.
 message TensorProto {
@@ -81,7 +83,7 @@ message TensorProto {
 
   // DT_UINT64
   repeated uint64 uint64_val = 17 [packed = true];
-};
+}
 
 // Protocol buffer representing the serialization format of DT_VARIANT tensors.
 message VariantTensorDataProto {
diff --git a/tensorflow/core/framework/tensor_description.proto b/tensorflow/core/framework/tensor_description.proto
index 4c23c7e6205..8462c63bb38 100644
--- a/tensorflow/core/framework/tensor_description.proto
+++ b/tensorflow/core/framework/tensor_description.proto
@@ -1,14 +1,16 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/allocation_description.proto";
+import "tensorflow/core/framework/tensor_shape.proto";
+import "tensorflow/core/framework/types.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "TensorDescriptionProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-import "tensorflow/core/framework/types.proto";
-import "tensorflow/core/framework/tensor_shape.proto";
-import "tensorflow/core/framework/allocation_description.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_description_go_proto";
 
 message TensorDescription {
   // Data type of tensor elements
@@ -19,4 +21,4 @@ message TensorDescription {
 
   // Information about the size and allocator used for the data
   AllocationDescription allocation_description = 4;
-};
+}
diff --git a/tensorflow/core/framework/tensor_slice.proto b/tensorflow/core/framework/tensor_slice.proto
index a5c366ed606..4463658d391 100644
--- a/tensorflow/core/framework/tensor_slice.proto
+++ b/tensorflow/core/framework/tensor_slice.proto
@@ -1,13 +1,14 @@
 // Protocol buffer representing slices of a tensor
 
 syntax = "proto3";
+
+package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "TensorSliceProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
-
-package tensorflow;
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_slice_go_proto";
 
 // Can only be interpreted if you know the corresponding TensorShape.
 message TensorSliceProto {
@@ -27,7 +28,7 @@ message TensorSliceProto {
     oneof has_length {
       int64 length = 2;
     }
-  };
+  }
 
   // Extent of the slice in all tensor dimensions.
   //
@@ -35,4 +36,4 @@ message TensorSliceProto {
   // slice belongs to.  The order of sizes is the same as the order of
   // dimensions in the TensorShape.
   repeated Extent extent = 1;
-};
+}
diff --git a/tensorflow/core/framework/variable.proto b/tensorflow/core/framework/variable.proto
index b2978c75c36..09d7fb3d45c 100644
--- a/tensorflow/core/framework/variable.proto
+++ b/tensorflow/core/framework/variable.proto
@@ -6,8 +6,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "VariableProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto";
 
 // Indicates when a distributed variable will be synced.
 enum VariableSynchronization {
diff --git a/tensorflow/core/framework/versions.proto b/tensorflow/core/framework/versions.proto
index dd2ec552387..2cca6e37d32 100644
--- a/tensorflow/core/framework/versions.proto
+++ b/tensorflow/core/framework/versions.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "VersionsProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/versions_go_proto";
 
 // Version information for a piece of serialized data
 //
@@ -29,4 +30,4 @@ message VersionDef {
 
   // Specific consumer versions which are disallowed (e.g. due to bugs).
   repeated int32 bad_consumers = 3;
-};
+}
diff --git a/tensorflow/core/protobuf/autotuning.proto b/tensorflow/core/protobuf/autotuning.proto
index 1cecc6faff0..44ce088ff41 100644
--- a/tensorflow/core/protobuf/autotuning.proto
+++ b/tensorflow/core/protobuf/autotuning.proto
@@ -10,7 +10,7 @@ package tensorflow;
 import "google/protobuf/any.proto";
 import "google/protobuf/duration.proto";
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 message CudnnVersion {
   int32 major = 1;
diff --git a/tensorflow/core/protobuf/bfc_memory_map.proto b/tensorflow/core/protobuf/bfc_memory_map.proto
index cf7e833f003..6f7a5301af1 100644
--- a/tensorflow/core/protobuf/bfc_memory_map.proto
+++ b/tensorflow/core/protobuf/bfc_memory_map.proto
@@ -2,7 +2,7 @@ syntax = "proto3";
 
 package tensorflow;
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Some of the data from AllocatorStats
 message MemAllocatorStats {
diff --git a/tensorflow/core/protobuf/cluster.proto b/tensorflow/core/protobuf/cluster.proto
index c696d345e0c..6c7162fe433 100644
--- a/tensorflow/core/protobuf/cluster.proto
+++ b/tensorflow/core/protobuf/cluster.proto
@@ -16,11 +16,12 @@ limitations under the License.
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ClusterProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.distruntime";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // This file contains protos to be used when defining a TensorFlow
 // cluster.
diff --git a/tensorflow/core/protobuf/config.proto b/tensorflow/core/protobuf/config.proto
index 4f9b0aa5359..e3c2bcdf6b4 100644
--- a/tensorflow/core/protobuf/config.proto
+++ b/tensorflow/core/protobuf/config.proto
@@ -2,12 +2,6 @@ syntax = "proto3";
 
 package tensorflow;
 
-option cc_enable_arenas = true;
-option java_outer_classname = "ConfigProtos";
-option java_multiple_files = true;
-option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
 import "tensorflow/core/framework/cost_graph.proto";
 import "tensorflow/core/framework/graph.proto";
 import "tensorflow/core/framework/step_stats.proto";
@@ -15,6 +9,12 @@ import "tensorflow/core/protobuf/cluster.proto";
 import "tensorflow/core/protobuf/debug.proto";
 import "tensorflow/core/protobuf/rewriter_config.proto";
 
+option cc_enable_arenas = true;
+option java_outer_classname = "ConfigProtos";
+option java_multiple_files = true;
+option java_package = "org.tensorflow.framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 message GPUOptions {
   // Fraction of the available GPU memory to allocate for each process.
   // 1 means to allocate all of the GPU memory, 0.5 means the process
@@ -578,7 +578,7 @@ message ConfigProto {
     // The XLA fusion autotuner can improve performance by executing a heuristic
     // search on the compiler parameters.
     int64 xla_fusion_autotuner_thresh = 15;
-  };
+  }
 
   Experimental experimental = 16;
 
@@ -636,7 +636,7 @@ message RunOptions {
     // and tail) latency.
     // Consider using this option for CPU-bound workloads like inference.
     bool use_run_handler_pool = 2;
-  };
+  }
 
   Experimental experimental = 8;
 
diff --git a/tensorflow/core/protobuf/control_flow.proto b/tensorflow/core/protobuf/control_flow.proto
index 5f44878c44c..24f862029dc 100644
--- a/tensorflow/core/protobuf/control_flow.proto
+++ b/tensorflow/core/protobuf/control_flow.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "ControlFlowProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Control flow context related protocol buffers.
 
diff --git a/tensorflow/core/protobuf/conv_autotuning.proto b/tensorflow/core/protobuf/conv_autotuning.proto
index e49be02f5f7..b3af2f0769e 100644
--- a/tensorflow/core/protobuf/conv_autotuning.proto
+++ b/tensorflow/core/protobuf/conv_autotuning.proto
@@ -6,7 +6,7 @@ package tensorflow;
 
 import "tensorflow/stream_executor/dnn.proto";
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A convolution. Currently it's only used for logging. In the future, we may
 // want to use it in the API as well.
diff --git a/tensorflow/core/protobuf/critical_section.proto b/tensorflow/core/protobuf/critical_section.proto
index 7954e7ba87c..991d7ef1280 100644
--- a/tensorflow/core/protobuf/critical_section.proto
+++ b/tensorflow/core/protobuf/critical_section.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "CriticalSectionProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Protocol buffer representing a CriticalSection.
 message CriticalSectionDef {
diff --git a/tensorflow/core/protobuf/debug.proto b/tensorflow/core/protobuf/debug.proto
index 3cfab170f02..21df4a12e7d 100644
--- a/tensorflow/core/protobuf/debug.proto
+++ b/tensorflow/core/protobuf/debug.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "DebugProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Option for watching a node in TensorFlow Debugger (tfdbg).
 message DebugTensorWatch {
diff --git a/tensorflow/core/protobuf/debug_event.proto b/tensorflow/core/protobuf/debug_event.proto
index 4b34864361c..005abe53194 100644
--- a/tensorflow/core/protobuf/debug_event.proto
+++ b/tensorflow/core/protobuf/debug_event.proto
@@ -9,8 +9,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "DebugEventProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.util";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Available modes for extracting debugging information from a Tensor.
 // TODO(cais): Document the detailed column names and semantics in a separate
diff --git a/tensorflow/core/protobuf/device_filters.proto b/tensorflow/core/protobuf/device_filters.proto
index bbfa0af11f7..62dd427e03a 100644
--- a/tensorflow/core/protobuf/device_filters.proto
+++ b/tensorflow/core/protobuf/device_filters.proto
@@ -21,8 +21,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "DeviceFiltersProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.distruntime";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // This file contains protos to be used when defining a TensorFlow
 // cluster.
diff --git a/tensorflow/core/protobuf/device_properties.proto b/tensorflow/core/protobuf/device_properties.proto
index 11e1258e75e..f6587c8aef2 100644
--- a/tensorflow/core/protobuf/device_properties.proto
+++ b/tensorflow/core/protobuf/device_properties.proto
@@ -16,9 +16,10 @@ limitations under the License.
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "DevicePropertiesProtos";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 message DeviceProperties {
   // Device type (CPU, GPU, ...)
diff --git a/tensorflow/core/protobuf/eager_service.proto b/tensorflow/core/protobuf/eager_service.proto
index e4fb49fbcaf..6a9ad30f1f8 100644
--- a/tensorflow/core/protobuf/eager_service.proto
+++ b/tensorflow/core/protobuf/eager_service.proto
@@ -11,7 +11,7 @@ import "tensorflow/core/framework/versions.proto";
 import "tensorflow/core/protobuf/remote_tensor_handle.proto";
 import "tensorflow/core/protobuf/tensorflow_server.proto";
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A proto representation of an eager operation.
 message Operation {
diff --git a/tensorflow/core/protobuf/error_codes.proto b/tensorflow/core/protobuf/error_codes.proto
index 9ef59d79ccd..a880fdfd8c9 100644
--- a/tensorflow/core/protobuf/error_codes.proto
+++ b/tensorflow/core/protobuf/error_codes.proto
@@ -6,8 +6,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "ErrorCodesProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // The canonical error codes for TensorFlow APIs.
 //
diff --git a/tensorflow/core/protobuf/graph_debug_info.proto b/tensorflow/core/protobuf/graph_debug_info.proto
index dddcc0ef341..3d8d7733c64 100644
--- a/tensorflow/core/protobuf/graph_debug_info.proto
+++ b/tensorflow/core/protobuf/graph_debug_info.proto
@@ -6,8 +6,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "GraphDebugInfoProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 message GraphDebugInfo {
   // This represents a file/line location in the source code.
diff --git a/tensorflow/core/protobuf/master.proto b/tensorflow/core/protobuf/master.proto
index ecb7057f91c..0bd21fd8bd7 100644
--- a/tensorflow/core/protobuf/master.proto
+++ b/tensorflow/core/protobuf/master.proto
@@ -17,12 +17,6 @@ syntax = "proto3";
 
 package tensorflow;
 
-option cc_enable_arenas = true;
-option java_outer_classname = "DistributedRuntimeProtos";
-option java_multiple_files = true;
-option java_package = "org.tensorflow.distruntime";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
 import "tensorflow/core/framework/device_attributes.proto";
 import "tensorflow/core/framework/graph.proto";
 import "tensorflow/core/framework/tensor.proto";
@@ -30,6 +24,12 @@ import "tensorflow/core/protobuf/config.proto";
 import "tensorflow/core/protobuf/error_codes.proto";
 import "tensorflow/core/protobuf/named_tensor.proto";
 
+option cc_enable_arenas = true;
+option java_outer_classname = "DistributedRuntimeProtos";
+option java_multiple_files = true;
+option java_package = "org.tensorflow.distruntime";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // CreateSession method request/response protos.
diff --git a/tensorflow/core/protobuf/master_service.proto b/tensorflow/core/protobuf/master_service.proto
index ce0e4f64354..aa8d13f2b86 100644
--- a/tensorflow/core/protobuf/master_service.proto
+++ b/tensorflow/core/protobuf/master_service.proto
@@ -16,11 +16,13 @@ limitations under the License.
 syntax = "proto3";
 
 package tensorflow.grpc;
+
+import "tensorflow/core/protobuf/master.proto";
+
 option java_outer_classname = "MasterServiceProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.distruntime";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-import "tensorflow/core/protobuf/master.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 ////////////////////////////////////////////////////////////////////////////////
 //
diff --git a/tensorflow/core/protobuf/meta_graph.proto b/tensorflow/core/protobuf/meta_graph.proto
index a3aed1f397e..c560451f9db 100644
--- a/tensorflow/core/protobuf/meta_graph.proto
+++ b/tensorflow/core/protobuf/meta_graph.proto
@@ -2,12 +2,6 @@ syntax = "proto3";
 
 package tensorflow;
 
-option cc_enable_arenas = true;
-option java_outer_classname = "MetaGraphProtos";
-option java_multiple_files = true;
-option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
 import "google/protobuf/any.proto";
 import "tensorflow/core/framework/graph.proto";
 import "tensorflow/core/framework/op_def.proto";
@@ -17,6 +11,12 @@ import "tensorflow/core/protobuf/saved_object_graph.proto";
 import "tensorflow/core/protobuf/saver.proto";
 import "tensorflow/core/protobuf/struct.proto";
 
+option cc_enable_arenas = true;
+option java_outer_classname = "MetaGraphProtos";
+option java_multiple_files = true;
+option java_package = "org.tensorflow.framework";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 // NOTE: This protocol buffer is evolving, and will go through revisions in the
 // coming months.
 //
diff --git a/tensorflow/core/protobuf/named_tensor.proto b/tensorflow/core/protobuf/named_tensor.proto
index 6e2f7feee29..4210f040e82 100644
--- a/tensorflow/core/protobuf/named_tensor.proto
+++ b/tensorflow/core/protobuf/named_tensor.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/framework/tensor.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "NamedTensorProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-import "tensorflow/core/framework/tensor.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A pair of tensor name and tensor values.
 message NamedTensorProto {
diff --git a/tensorflow/core/protobuf/queue_runner.proto b/tensorflow/core/protobuf/queue_runner.proto
index c189ff3a570..981ae0d463e 100644
--- a/tensorflow/core/protobuf/queue_runner.proto
+++ b/tensorflow/core/protobuf/queue_runner.proto
@@ -2,13 +2,13 @@ syntax = "proto3";
 
 package tensorflow;
 
+import "tensorflow/core/protobuf/error_codes.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "QueueRunnerProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-import "tensorflow/core/protobuf/error_codes.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Protocol buffer representing a QueueRunner.
 message QueueRunnerDef {
diff --git a/tensorflow/core/protobuf/remote_tensor_handle.proto b/tensorflow/core/protobuf/remote_tensor_handle.proto
index 6148d602a6d..10995226a9b 100644
--- a/tensorflow/core/protobuf/remote_tensor_handle.proto
+++ b/tensorflow/core/protobuf/remote_tensor_handle.proto
@@ -9,8 +9,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "RemoteTensorHandleProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 message ResourceDtypeAndShape {
   DataType dtype = 1;
diff --git a/tensorflow/core/protobuf/replay_log.proto b/tensorflow/core/protobuf/replay_log.proto
index 80aa6ee85bb..bf0155946b6 100644
--- a/tensorflow/core/protobuf/replay_log.proto
+++ b/tensorflow/core/protobuf/replay_log.proto
@@ -5,8 +5,7 @@ package tensorflow;
 import "tensorflow/core/protobuf/master.proto";
 
 option cc_enable_arenas = true;
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Records the creation of a new replay session.  We record the device listing
 // here to capture the state of the cluster.
diff --git a/tensorflow/core/protobuf/rewriter_config.proto b/tensorflow/core/protobuf/rewriter_config.proto
index 54943eec07b..d1cdb515341 100644
--- a/tensorflow/core/protobuf/rewriter_config.proto
+++ b/tensorflow/core/protobuf/rewriter_config.proto
@@ -2,15 +2,14 @@ syntax = "proto3";
 
 package tensorflow;
 
+import "tensorflow/core/framework/attr_value.proto";
+import "tensorflow/core/protobuf/verifier_config.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "RewriterConfigProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-
-import "tensorflow/core/framework/attr_value.proto";
-import "tensorflow/core/protobuf/verifier_config.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 message AutoParallelOptions {
   bool enable = 1;
diff --git a/tensorflow/core/protobuf/saved_model.proto b/tensorflow/core/protobuf/saved_model.proto
index 03789d3df72..57f018bb249 100644
--- a/tensorflow/core/protobuf/saved_model.proto
+++ b/tensorflow/core/protobuf/saved_model.proto
@@ -1,12 +1,14 @@
 syntax = "proto3";
 
 package tensorflow;
+
+import "tensorflow/core/protobuf/meta_graph.proto";
+
 option cc_enable_arenas = true;
 option java_outer_classname = "SavedModelProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-import "tensorflow/core/protobuf/meta_graph.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // SavedModel is the high level serialization format for TensorFlow Models.
 // See [todo: doc links, similar to session_bundle] for more information.
diff --git a/tensorflow/core/protobuf/saved_object_graph.proto b/tensorflow/core/protobuf/saved_object_graph.proto
index f66df5b0892..e794b885dec 100644
--- a/tensorflow/core/protobuf/saved_object_graph.proto
+++ b/tensorflow/core/protobuf/saved_object_graph.proto
@@ -10,8 +10,7 @@ import "tensorflow/core/protobuf/struct.proto";
 import "tensorflow/core/protobuf/trackable_object_graph.proto";
 
 option cc_enable_arenas = true;
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A SavedObjectGraph is part of object-based SavedModels in TF 2.0. It
 // describes the directed graph of Python objects (or equivalent in other
diff --git a/tensorflow/core/protobuf/saver.proto b/tensorflow/core/protobuf/saver.proto
index 42453861459..5ba79447750 100644
--- a/tensorflow/core/protobuf/saver.proto
+++ b/tensorflow/core/protobuf/saver.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "SaverProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.util";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Protocol buffer representing the configuration of a Saver.
 message SaverDef {
diff --git a/tensorflow/core/protobuf/struct.proto b/tensorflow/core/protobuf/struct.proto
index 0508640f814..91af120ad8a 100644
--- a/tensorflow/core/protobuf/struct.proto
+++ b/tensorflow/core/protobuf/struct.proto
@@ -2,11 +2,11 @@ syntax = "proto3";
 
 package tensorflow;
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-
 import "tensorflow/core/framework/tensor_shape.proto";
 import "tensorflow/core/framework/types.proto";
 
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 // `StructuredValue` represents a dynamically typed value representing various
 // data structures that are inspired by Python data structures typically used in
 // TensorFlow functions as inputs and outputs.
diff --git a/tensorflow/core/protobuf/tensor_bundle.proto b/tensorflow/core/protobuf/tensor_bundle.proto
index 681c01bbbd4..04ccc0faf36 100644
--- a/tensorflow/core/protobuf/tensor_bundle.proto
+++ b/tensorflow/core/protobuf/tensor_bundle.proto
@@ -1,16 +1,18 @@
 syntax = "proto3";
 
 package tensorflow;
-option cc_enable_arenas = true;
-option java_outer_classname = "TensorBundleProtos";
-option java_multiple_files = true;
-option java_package = "org.tensorflow.util";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+
 import "tensorflow/core/framework/tensor_shape.proto";
 import "tensorflow/core/framework/tensor_slice.proto";
 import "tensorflow/core/framework/types.proto";
 import "tensorflow/core/framework/versions.proto";
 
+option cc_enable_arenas = true;
+option java_outer_classname = "TensorBundleProtos";
+option java_multiple_files = true;
+option java_package = "org.tensorflow.util";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 // Protos used in the tensor bundle module (tf/core/util/tensor_bundle/).
 
 // Special header that is associated with a bundle.
diff --git a/tensorflow/core/protobuf/tensorflow_server.proto b/tensorflow/core/protobuf/tensorflow_server.proto
index 6b3010ab37e..7136f29d58a 100644
--- a/tensorflow/core/protobuf/tensorflow_server.proto
+++ b/tensorflow/core/protobuf/tensorflow_server.proto
@@ -25,8 +25,8 @@ option cc_enable_arenas = true;
 option java_outer_classname = "ServerProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.distruntime";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
 // Defines the configuration of a single TensorFlow server.
 message ServerDef {
   // The cluster of which this server is a member.
diff --git a/tensorflow/core/protobuf/trace_events.proto b/tensorflow/core/protobuf/trace_events.proto
index 84cbea5bacf..a6650a982f3 100644
--- a/tensorflow/core/protobuf/trace_events.proto
+++ b/tensorflow/core/protobuf/trace_events.proto
@@ -6,8 +6,7 @@ option cc_enable_arenas = true;
 option java_outer_classname = "TraceEventsProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A 'Trace' contains metadata for the individual traces of a system.
 message Trace {
diff --git a/tensorflow/core/protobuf/trackable_object_graph.proto b/tensorflow/core/protobuf/trackable_object_graph.proto
index 54969398590..48dbd92a181 100644
--- a/tensorflow/core/protobuf/trackable_object_graph.proto
+++ b/tensorflow/core/protobuf/trackable_object_graph.proto
@@ -3,8 +3,7 @@ syntax = "proto3";
 package tensorflow;
 
 option cc_enable_arenas = true;
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // A TensorBundle addition which saves extra information about the objects which
 // own variables, allowing for more robust checkpoint loading into modified
diff --git a/tensorflow/core/protobuf/transport_options.proto b/tensorflow/core/protobuf/transport_options.proto
index 1a88d6d4b94..23f92c3529f 100644
--- a/tensorflow/core/protobuf/transport_options.proto
+++ b/tensorflow/core/protobuf/transport_options.proto
@@ -2,7 +2,7 @@ syntax = "proto3";
 
 package tensorflow;
 
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // Extra data needed on a non-RDMA RecvBufResponse.
 message RecvBufRespExtra {
diff --git a/tensorflow/core/protobuf/verifier_config.proto b/tensorflow/core/protobuf/verifier_config.proto
index 5a1373b1ccf..4440aad6ac9 100644
--- a/tensorflow/core/protobuf/verifier_config.proto
+++ b/tensorflow/core/protobuf/verifier_config.proto
@@ -1,11 +1,12 @@
 syntax = "proto3";
 
 package tensorflow;
+
 option cc_enable_arenas = true;
 option java_outer_classname = "VerifierConfigProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.framework";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 // The config for graph verifiers.
 message VerifierConfig {
diff --git a/tensorflow/core/protobuf/worker.proto b/tensorflow/core/protobuf/worker.proto
index 3a8fbcfb015..b6bbcfc3431 100644
--- a/tensorflow/core/protobuf/worker.proto
+++ b/tensorflow/core/protobuf/worker.proto
@@ -17,12 +17,6 @@ syntax = "proto3";
 
 package tensorflow;
 
-option cc_enable_arenas = true;
-option java_outer_classname = "WorkerProtos";
-option java_multiple_files = true;
-option java_package = "org.tensorflow.distruntime";
-
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
 import "google/protobuf/any.proto";
 import "tensorflow/core/framework/cost_graph.proto";
 import "tensorflow/core/framework/device_attributes.proto";
@@ -37,6 +31,12 @@ import "tensorflow/core/protobuf/error_codes.proto";
 import "tensorflow/core/protobuf/named_tensor.proto";
 import "tensorflow/core/protobuf/tensorflow_server.proto";
 
+option cc_enable_arenas = true;
+option java_outer_classname = "WorkerProtos";
+option java_multiple_files = true;
+option java_package = "org.tensorflow.distruntime";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // GetStatus method request/response messages
diff --git a/tensorflow/core/protobuf/worker_service.proto b/tensorflow/core/protobuf/worker_service.proto
index 9ebbd553f21..38d8bc1da6b 100644
--- a/tensorflow/core/protobuf/worker_service.proto
+++ b/tensorflow/core/protobuf/worker_service.proto
@@ -16,11 +16,13 @@ limitations under the License.
 syntax = "proto3";
 
 package tensorflow.grpc;
+
+import "tensorflow/core/protobuf/worker.proto";
+
 option java_outer_classname = "WorkerServiceProtos";
 option java_multiple_files = true;
 option java_package = "org.tensorflow.distruntime";
-option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
-import "tensorflow/core/protobuf/worker.proto";
+option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto";
 
 ////////////////////////////////////////////////////////////////////////////////
 //
@@ -74,8 +76,7 @@ service WorkerService {
   rpc Tracing(TracingRequest) returns (TracingResponse);
 
   // See worker.proto for details.
-  rpc RecvBuf(RecvBufRequest) returns (RecvBufResponse) {
-  }
+  rpc RecvBuf(RecvBufRequest) returns (RecvBufResponse) {}
 
   // See worker.proto for details.
   rpc GetStepSequence(GetStepSequenceRequest) returns (GetStepSequenceResponse);
diff --git a/tensorflow/go/saved_model.go b/tensorflow/go/saved_model.go
index fdcc124b200..0fbd6081ef2 100644
--- a/tensorflow/go/saved_model.go
+++ b/tensorflow/go/saved_model.go
@@ -21,8 +21,7 @@ import (
 	"unsafe"
 
 	"github.com/golang/protobuf/proto"
-
-	tfpb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf"
+	corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto"
 )
 
 // #include <stdlib.h>
@@ -73,7 +72,7 @@ func LoadSavedModel(exportDir string, tags []string, options *SessionOptions) (*
 	C.free(unsafe.Pointer(cExportDir))
 
 	metaGraphDefBytes := C.GoBytes(metaGraphDefBuf.data, C.int(metaGraphDefBuf.length))
-	metaGraphDef := new(tfpb.MetaGraphDef)
+	metaGraphDef := new(corepb.MetaGraphDef)
 	if err := proto.Unmarshal(metaGraphDefBytes, metaGraphDef); err != nil {
 		return nil, err
 	}
@@ -88,7 +87,7 @@ func LoadSavedModel(exportDir string, tags []string, options *SessionOptions) (*
 	return &SavedModel{Session: s, Graph: graph, Signatures: signatures}, nil
 }
 
-func generateSignatures(pb map[string]*tfpb.SignatureDef) map[string]Signature {
+func generateSignatures(pb map[string]*corepb.SignatureDef) map[string]Signature {
 	signatures := make(map[string]Signature)
 	for name, signature := range pb {
 		signatures[name] = signatureDefFromProto(signature)
diff --git a/tensorflow/go/signature.go b/tensorflow/go/signature.go
index 868c09e2a22..8aac0e2ec93 100644
--- a/tensorflow/go/signature.go
+++ b/tensorflow/go/signature.go
@@ -16,7 +16,7 @@ limitations under the License.
 
 package tensorflow
 
-import tfpb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf"
+import corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto"
 
 // #include "tensorflow/c/c_api.h"
 import "C"
@@ -90,7 +90,7 @@ type TensorInfo struct {
 	Shape Shape
 }
 
-func signatureDefFromProto(pb *tfpb.SignatureDef) Signature {
+func signatureDefFromProto(pb *corepb.SignatureDef) Signature {
 	inputs := make(map[string]TensorInfo)
 	for name, input := range pb.GetInputs() {
 		inputs[name] = tensorInfoFromProto(input)
@@ -106,7 +106,7 @@ func signatureDefFromProto(pb *tfpb.SignatureDef) Signature {
 	}
 }
 
-func tensorInfoFromProto(pb *tfpb.TensorInfo) TensorInfo {
+func tensorInfoFromProto(pb *corepb.TensorInfo) TensorInfo {
 	var dims []int64
 	for _, d := range pb.GetTensorShape().GetDim() {
 		dims = append(dims, d.GetSize())
diff --git a/tensorflow/go/signature_test.go b/tensorflow/go/signature_test.go
index 97695ff0084..e6927f3cebd 100644
--- a/tensorflow/go/signature_test.go
+++ b/tensorflow/go/signature_test.go
@@ -20,16 +20,16 @@ import (
 	"fmt"
 	"testing"
 
+	corepb "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto"
 	tspb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto"
 	typb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/types_go_proto"
-	tfpb "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf"
 )
 
 func TestSignatureFromProto(t *testing.T) {
-	got := signatureDefFromProto(&tfpb.SignatureDef{
-		Inputs: map[string]*tfpb.TensorInfo{
-			"input_1": &tfpb.TensorInfo{
-				Encoding: &tfpb.TensorInfo_Name{
+	got := signatureDefFromProto(&corepb.SignatureDef{
+		Inputs: map[string]*corepb.TensorInfo{
+			"input_1": &corepb.TensorInfo{
+				Encoding: &corepb.TensorInfo_Name{
 					Name: "tensor_1",
 				},
 				Dtype: typb.DataType_DT_INT8,
@@ -41,8 +41,8 @@ func TestSignatureFromProto(t *testing.T) {
 					},
 				},
 			},
-			"input_2": &tfpb.TensorInfo{
-				Encoding: &tfpb.TensorInfo_Name{
+			"input_2": &corepb.TensorInfo{
+				Encoding: &corepb.TensorInfo_Name{
 					Name: "tensor_2",
 				},
 				Dtype: typb.DataType_DT_FLOAT,
@@ -55,9 +55,9 @@ func TestSignatureFromProto(t *testing.T) {
 				},
 			},
 		},
-		Outputs: map[string]*tfpb.TensorInfo{
-			"output_1": &tfpb.TensorInfo{
-				Encoding: &tfpb.TensorInfo_Name{
+		Outputs: map[string]*corepb.TensorInfo{
+			"output_1": &corepb.TensorInfo{
+				Encoding: &corepb.TensorInfo_Name{
 					Name: "tensor_3",
 				},
 				Dtype: typb.DataType_DT_STRING,
@@ -69,8 +69,8 @@ func TestSignatureFromProto(t *testing.T) {
 					},
 				},
 			},
-			"output_2": &tfpb.TensorInfo{
-				Encoding: &tfpb.TensorInfo_Name{
+			"output_2": &corepb.TensorInfo{
+				Encoding: &corepb.TensorInfo_Name{
 					Name: "tensor_4",
 				},
 				Dtype: typb.DataType_DT_BOOL,
@@ -140,8 +140,8 @@ func TestSignatureFromProto(t *testing.T) {
 }
 
 func TestTensorInfoFromProto(t *testing.T) {
-	got := tensorInfoFromProto(&tfpb.TensorInfo{
-		Encoding: &tfpb.TensorInfo_Name{
+	got := tensorInfoFromProto(&corepb.TensorInfo{
+		Encoding: &corepb.TensorInfo_Name{
 			Name: "tensor",
 		},
 		Dtype: typb.DataType_DT_INT8,