go.mod: rename google.golang.org/proto as github.com/golang/protobuf/v2

This change was created by running:
	git ls-files | xargs sed -i "s|google.golang.org/proto|github.com/golang/protobuf/v2|g"

This change is *not* an endorsement of "github.com/golang/protobuf/v2" as the
final import path when the v2 API is eventually released as stable.
We continue to reserve the right to make breaking changes as we see fit.

This change enables us to host the v2 API on a repository that is go-gettable
(since go.googlesource.com is not a known host by the "go get" tool;
and google.golang.org/proto was just a stub URL that is not currently served).
Thus, we can start work on a forked version of the v1 API that explores
what it would take to implement v1 in terms of v2 in a backwards compatible way.

Change-Id: Ia3ebc41ac4238af62ee140200d3158b53ac9ec48
Reviewed-on: https://go-review.googlesource.com/136736
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2018-09-21 17:44:00 -07:00 committed by Joe Tsai
parent b4af2c62e0
commit 01ab29648e
67 changed files with 99 additions and 99 deletions

View File

@ -20,8 +20,8 @@ import (
"github.com/golang/protobuf/proto"
descpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
"google.golang.org/proto/protogen"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/protogen"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// generatedCodeVersion indicates a version of the generated code.

View File

@ -5,8 +5,8 @@ import (
"strings"
"github.com/golang/protobuf/proto"
"google.golang.org/proto/protogen"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/protogen"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// genOneofField generates the struct field for a oneof.

View File

@ -11,8 +11,8 @@ package main
import (
"github.com/golang/protobuf/proto"
descpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
"google.golang.org/proto/protogen"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/protogen"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// messageOptions returns the MessageOptions for a message.

View File

@ -7,7 +7,7 @@ syntax = "proto2";
// COMMENT: package goproto.protoc.comments;
package goproto.protoc.comments;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/comments";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/comments";
// COMMENT: Message1
message Message1 {

View File

@ -7,7 +7,7 @@ syntax = "proto3";
package goproto.protoc.comments;
option deprecated = true;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/comments";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/comments";
message DeprecatedMessage {
option deprecated = true;

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.extension.base;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/base";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/base";
message BaseMessage {
optional string field = 1;

View File

@ -6,8 +6,8 @@ package ext
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
base "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/base"
extra "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/extra"
base "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/base"
extra "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/extra"
math "math"
)

View File

@ -9,7 +9,7 @@ import "extensions/extra/extra.proto";
package goproto.protoc.extension.ext;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/ext";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/ext";
message Message {
optional bytes data = 1;

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.extension.extra;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/extra";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/extra";
message ExtraMessage {
optional bytes data = 1;

View File

@ -8,7 +8,7 @@ import "google/protobuf/descriptor.proto";
package goproto.protoc.extension.proto3;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/extensions/proto3";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/proto3";
message Message {}
enum Enum { ZERO = 0; }

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.fieldnames;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/fieldnames";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/fieldnames";
// Assorted edge cases in field name conflict resolution.
//

View File

@ -6,7 +6,7 @@ package import_public
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
sub "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public/sub"
sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub"
math "math"
)

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.import_public;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public";
import public "import_public/sub/a.proto"; // Different Go package.
import public "import_public/b.proto"; // Same Go package.

View File

@ -6,7 +6,7 @@ package import_public
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
sub "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public/sub"
sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub"
math "math"
)

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.import_public;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public";
import "import_public/sub/a.proto";

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.import_public.sub;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public/sub";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub";
import "import_public/sub/b.proto";

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.import_public.sub;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/import_public/sub";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub";
message M2 {
}

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.proto2;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto2";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto2";
// EnumType1 comment.
enum EnumType1 {

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.proto2;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto2";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto2";
message FieldTestMessage {
optional bool optional_bool = 1;

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.proto2;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto2";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto2";
message Layer1 {
message Layer2 {

View File

@ -6,7 +6,7 @@ syntax = "proto2";
package goproto.protoc.proto2;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto2";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto2";
message Message {
optional int32 i32 = 1;

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.proto3;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto3";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto3";
enum Enum {
ZERO = 0;

View File

@ -6,7 +6,7 @@ syntax = "proto3";
package goproto.protoc.proto3;
option go_package = "google.golang.org/proto/cmd/protoc-gen-go/testdata/proto3";
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto3";
message FieldTestMessage {
string optional_bool = 1;

2
go.mod
View File

@ -1,4 +1,4 @@
module google.golang.org/proto
module github.com/golang/protobuf/v2
require (
github.com/golang/protobuf v1.2.0

View File

@ -200,8 +200,8 @@ func writeSource(file, src string) {
"fmt",
"sync",
"",
"google.golang.org/proto/internal/pragma",
"google.golang.org/proto/reflect/protoreflect",
"github.com/golang/protobuf/v2/internal/pragma",
"github.com/golang/protobuf/v2/reflect/protoreflect",
} {
if pkg == "" {
imports = append(imports, "") // blank line between stdlib and proto packages

View File

@ -17,10 +17,10 @@ import (
"strconv"
"strings"
"google.golang.org/proto/internal/encoding/pack"
"google.golang.org/proto/internal/encoding/wire"
"google.golang.org/proto/reflect/protoreflect"
"google.golang.org/proto/reflect/prototype"
"github.com/golang/protobuf/v2/internal/encoding/pack"
"github.com/golang/protobuf/v2/internal/encoding/wire"
"github.com/golang/protobuf/v2/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/prototype"
)
func main() {

View File

@ -12,8 +12,8 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
pref "google.golang.org/proto/reflect/protoreflect"
ptype "google.golang.org/proto/reflect/prototype"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
ptype "github.com/golang/protobuf/v2/reflect/prototype"
)
func TestFields(t *testing.T) {

View File

@ -10,7 +10,7 @@ import (
"regexp"
"unicode/utf8"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
type syntaxError struct{ error }

View File

@ -7,7 +7,7 @@ package json
import (
"strings"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
// Marshal serializes v as the JSON format.

View File

@ -10,7 +10,7 @@ import (
"regexp"
"strconv"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
// marshalNumber encodes v as a Number.

View File

@ -12,7 +12,7 @@ import (
"unicode/utf16"
"unicode/utf8"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
func (p *encoder) marshalString(v Value) error {

View File

@ -21,8 +21,8 @@ import (
"unicode"
"unicode/utf8"
"google.golang.org/proto/internal/encoding/wire"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/encoding/wire"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// Number is the field number; aliased from the wire package for convenience.

View File

@ -11,9 +11,9 @@ import (
"math"
"testing"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
ptype "github.com/golang/protobuf/v2/reflect/prototype"
"github.com/google/go-cmp/cmp"
pref "google.golang.org/proto/reflect/protoreflect"
ptype "google.golang.org/proto/reflect/prototype"
)
var msgDesc = func() pref.MessageDescriptor {

View File

@ -10,8 +10,8 @@ import (
"regexp"
"unicode/utf8"
"google.golang.org/proto/internal/errors"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/errors"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
type syntaxError struct{ error }

View File

@ -8,7 +8,7 @@ import (
"bytes"
"strings"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
// Marshal serializes v as the proto text format, where v must be a Message.

View File

@ -12,7 +12,7 @@ import (
"strconv"
"strings"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
// marshalNumber encodes v as either a Bool, Int, Uint, or Float.

View File

@ -15,7 +15,7 @@ import (
"unicode/utf16"
"unicode/utf8"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
func (p *encoder) marshalString(v Value) error {

View File

@ -11,10 +11,10 @@ import (
"testing"
"unicode/utf8"
"github.com/golang/protobuf/v2/internal/flags"
"github.com/golang/protobuf/v2/reflect/protoreflect"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/proto/internal/flags"
"google.golang.org/proto/reflect/protoreflect"
)
func Test(t *testing.T) {

View File

@ -33,8 +33,8 @@ import (
"math"
"strings"
"google.golang.org/proto/internal/flags"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/flags"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// Type represents a type expressible in the text format.

View File

@ -11,7 +11,7 @@ import (
"io"
"math/bits"
"google.golang.org/proto/internal/errors"
"github.com/golang/protobuf/v2/internal/errors"
)
// Number represents the field number.

View File

@ -9,7 +9,7 @@ import (
"strconv"
"strings"
pref "google.golang.org/proto/reflect/protoreflect"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
type MessageInfo struct {

View File

@ -8,8 +8,8 @@ import (
"fmt"
"reflect"
"google.golang.org/proto/internal/flags"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/flags"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
type fieldInfo struct {

View File

@ -10,8 +10,8 @@ import (
"github.com/google/go-cmp/cmp"
pref "google.golang.org/proto/reflect/protoreflect"
ptype "google.golang.org/proto/reflect/prototype"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
ptype "github.com/golang/protobuf/v2/reflect/prototype"
)
type (

View File

@ -8,7 +8,7 @@ import (
"unicode"
"unicode/utf8"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// A GoIdent is a Go identifier, consisting of a name and import path.

View File

@ -29,10 +29,10 @@ import (
"github.com/golang/protobuf/proto"
descpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
pluginpb "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/golang/protobuf/v2/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoregistry"
"github.com/golang/protobuf/v2/reflect/prototype"
"golang.org/x/tools/go/ast/astutil"
"google.golang.org/proto/reflect/protoreflect"
"google.golang.org/proto/reflect/protoregistry"
"google.golang.org/proto/reflect/prototype"
)
// Run executes a function as a protoc plugin.

View File

@ -30,8 +30,8 @@ import (
"regexp"
"strings"
"google.golang.org/proto/internal/encoding/wire"
"google.golang.org/proto/internal/pragma"
"github.com/golang/protobuf/v2/internal/encoding/wire"
"github.com/golang/protobuf/v2/internal/pragma"
)
type doNotImplement pragma.DoNotImplement

View File

@ -4,7 +4,7 @@
package protoreflect
import "google.golang.org/proto/internal/encoding/wire"
import "github.com/golang/protobuf/v2/internal/encoding/wire"
// TODO: Document the behavior of each Range operation when a mutation
// occurs while ranging. Also document the order.

View File

@ -6,7 +6,7 @@
package protoreflect
import "google.golang.org/proto/internal/pragma"
import "github.com/golang/protobuf/v2/internal/pragma"
type valueType int

View File

@ -9,7 +9,7 @@ package protoreflect
import (
"unsafe"
"google.golang.org/proto/internal/pragma"
"github.com/golang/protobuf/v2/internal/pragma"
)
type (

View File

@ -10,8 +10,8 @@ import (
"sort"
"strings"
"google.golang.org/proto/internal/errors"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/errors"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// TODO: Perhaps Register should record the frame of where the function was

View File

@ -12,9 +12,9 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
pref "google.golang.org/proto/reflect/protoreflect"
preg "google.golang.org/proto/reflect/protoregistry"
ptype "google.golang.org/proto/reflect/prototype"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
ptype "github.com/golang/protobuf/v2/reflect/prototype"
)
func TestFiles(t *testing.T) {

View File

@ -5,7 +5,7 @@
package prototype
import (
pref "google.golang.org/proto/reflect/protoreflect"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
// TODO: This cannot be implemented without proto.Unmarshal.

View File

@ -9,7 +9,7 @@ import (
"reflect"
"sync"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// GoEnum is a constructor for a protoreflect.EnumType.

View File

@ -6,7 +6,7 @@
package prototype
import pref "google.golang.org/proto/reflect/protoreflect"
import pref "github.com/golang/protobuf/v2/reflect/protoreflect"
func getNameBuilder() *nameBuilder { return nil }
func putNameBuilder(*nameBuilder) {}

View File

@ -11,7 +11,7 @@ import (
"sync"
"unsafe"
pref "google.golang.org/proto/reflect/protoreflect"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
var nameBuilderPool = sync.Pool{

View File

@ -4,7 +4,7 @@
package prototype
import "google.golang.org/proto/reflect/protoreflect"
import "github.com/golang/protobuf/v2/reflect/protoreflect"
// PlaceholderFile returns a placeholder protoreflect.FileType where
// only the Path and Package accessors are valid.

View File

@ -7,8 +7,8 @@ package prototype
import (
"fmt"
"google.golang.org/proto/internal/pragma"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
var (

View File

@ -14,7 +14,7 @@
package prototype
import (
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// Every struct has a "meta" struct embedded within it as a pointer.

View File

@ -12,10 +12,10 @@ import (
descriptorV1 "github.com/golang/protobuf/protoc-gen-go/descriptor"
"google.golang.org/proto/internal/encoding/text"
"google.golang.org/proto/internal/errors"
"google.golang.org/proto/reflect/protoreflect"
"google.golang.org/proto/reflect/protoregistry"
"github.com/golang/protobuf/v2/internal/encoding/text"
"github.com/golang/protobuf/v2/internal/errors"
"github.com/golang/protobuf/v2/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoregistry"
)
// TODO: Should we be responsible for validating other parts of the descriptor

View File

@ -8,9 +8,9 @@ import (
"fmt"
"sync"
"google.golang.org/proto/internal/pragma"
"google.golang.org/proto/internal/set"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
"github.com/golang/protobuf/v2/internal/set"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
type numbersMeta struct {

View File

@ -10,8 +10,8 @@ import (
"fmt"
"sync"
"google.golang.org/proto/internal/pragma"
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
type messagesMeta struct {

View File

@ -10,8 +10,8 @@ import (
"strings"
"sync"
"google.golang.org/proto/internal/pragma"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
// inheritedMeta is information inherited from the parent.

View File

@ -5,7 +5,7 @@
package prototype
import (
"google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/reflect/protoreflect"
)
// TODO: Should the constructors take in a value rather than a pointer?

View File

@ -7,8 +7,8 @@ package prototype
import (
"fmt"
"google.golang.org/proto/internal/pragma"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
type standaloneMessage struct{ m *StandaloneMessage }

View File

@ -12,8 +12,8 @@ import (
"strconv"
"strings"
"google.golang.org/proto/internal/pragma"
pref "google.golang.org/proto/reflect/protoreflect"
"github.com/golang/protobuf/v2/internal/pragma"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
type list interface {

View File

@ -15,7 +15,7 @@ import (
protoV1 "github.com/golang/protobuf/proto"
descriptorV1 "github.com/golang/protobuf/protoc-gen-go/descriptor"
pref "google.golang.org/proto/reflect/protoreflect"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
// TestDescriptors tests that the implementations do not declare additional

View File

@ -5,7 +5,7 @@
package prototype
import (
pref "google.golang.org/proto/reflect/protoreflect"
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
// TODO: This is important to prevent users from creating invalid types,