A recent change to the upstream descriptor.proto, appearing in
google.golang.org/protobuf@v1.33.0, removed the long-deprecated
FileOptions.php_generic_services field. This backwards-incompatible
change results in an incompatibility between the
github.com/golang/protobuf and google.golang.org/protobuf
modules.
Bump the google.golang.org/protobuf version in go.mod, regenerate
descriptors.
Increase the minimum Go version requirement to go1.17 (the minimum
supported by v1.33.0).
Run gofmt to update formatting to go1.22 standards.
For #1596
Use the new deprecation feature to mark this module as deprecated.
See https://golang.org/issue/40357.
Considerations:
* google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0 and below
used to generate a hard dependency on github.com/golang/protobuf,
which would be frustrating since it would force an explicit dependency
on a deprecated module. However, that is no longer the case in v1.26.0.
* google.golang.org/protobuf and github.com/golang/protobuf have
a cyclic dependency on each other. However, this should not be a problem
since proposal 40357 only marks direct dependencies in the go.mod file,
rather than all transitive dependencies in the go.sum file.
When a JSON null is encountered for a field which implements JSONPBUnmarshaler,
jsonpb will now call the unmarshal method, instead of just skipping the field.
Use protodesc.ToFileDescriptorProto to retrieve the raw descriptors
for legacy support instead of the undocumented ProtoLegacyRawDesc method
that we expect v2 to provide.
This change will cause the legacy proto package to incur a dependency
on the descriptorpb package.
While this module is deprecated, it is still important to ensure
that it continues to work with higher versions of Go.
Update travis.yml to test up to Go1.15.
Go 1.15 introduced a new `go vet` warning
(https://golang.org/doc/go1.15#vet) for conversions of the form
`string(x)` where `x` is an integer type other than `rune` or `byte`.
This warning is enabled by default when running `go test`. As a
consequence, running `go test github.com/golang/protobuf/proto`
results in a build failure prior to this commit.
The InternalMessageInfo type only exists to implement the
XXX methods on generated messages where those methods were
only ever intended to be called by this module itself.
Since v1.4.0, this module no longer relies on the XXX methods,
so the InternalMessageInfo and its implementation is supposed
to be dead code. Unfortunately, there are external usages that
violate our compatibility agreement and either directly call
the XXX methods or indirectly call it because some library
type-asserts to the existence of these methods.
This change adds minimal support for InternalMessageInfo by
just calling out directly to the v2 implementation.
The in argument is a []byte. Using the %v print flag prints this list of integers
instead of as a string representation of the enum value. Use %q instead.
Even through the grpc package is excluded from our compatibility agreement,
the v1.4.0 release accidentally reverted the package to an older revision.
Update this code to be identical to the v1.3.5 release (barring non-semantic
documentation changes).
Fixes#1111
All functionality is now implemented in terms of the next-generation
protobuf API in 'google.golang.org/protobuf'.
For information on the new protobuf API, see:
https://blog.golang.org/protobuf-apiv2
This commit merges the 'api-v2' branch with the 'master' branch.
In https://golang.org/cl/219598, we removed patching the well-known types
with an explicit go_package option and instead relied on M flags.
The lack of updated go_package options broke generate-alias since it
appears as if the import public is trying to alias Go identifiers
within the same Go package (thus generating nothing).
We fix generate-alias by replicating the same approach here,
where we construct the M flag mapping and pass it to protoc-gen-go.
The use of "revision" makes no sense for the first version
since it wasn't "revised" from anything. Nothing existed prior.
Change-Id: Ie82a03a3786e0ce7261a89032d2d3ebb12dcf4c0
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221025
Reviewed-by: Damien Neil <dneil@google.com>
Update .proto files to github.com/protocolbuffers v3.11.4.
Add go1.13 and go1.14 to .travis.yml.
Avoid one-line funcs in protoc-gen-go output to prevent variable
post-gofmt output with go1.14.
Use MessageV1, MessageV2, and MessageReflect directly.
Change-Id: Ifb44e2cc2dcb52a44894b52d2e932558e275aecd
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219558
Reviewed-by: Damien Neil <dneil@google.com>
Unfortunately, both DynamicMessage and *DynamicMessage implement
the proto.Message interface. Check for both.
Change-Id: I4d645fe5019f44b3ba349f731d1cbdcea481dffe
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220505
Reviewed-by: Damien Neil <dneil@google.com>
Check whether the parsed extension type actually matches the
target message type.
Change-Id: Ib21226b0bc217e33ebf56a1961ebc20732b5c64e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220438
Reviewed-by: Damien Neil <dneil@google.com>
These tests were removed during an era when we thought that
the v1 text implementation would just wrap the v2 implementation.
That didn't happen since too much code depended on the exact behavior
of the v1 implementation (exact output, bugs, error strings, etc).
Add the tests back in.
This is a cleaned up version of the tests from v1.3.3.
Change-Id: I0419af2092c4ed5703636366844ea61e910c5908
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220351
Reviewed-by: Damien Neil <dneil@google.com>
The UnmarshalState method provides information about whether the
message was initialized or not. Checking that bit saves performance
needing to verify again.
Generated files change because of newer versions of dependencies.
Change-Id: I1c1e99b7e28da5959d083ea8652b5fdc8e6c3124
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220500
Reviewed-by: Damien Neil <dneil@google.com>
Doesn't work in CI, since we don't have protoc available. Only tests the
gRPC generator, which is moving to the gRPC repo soon anyway. Just drop
it.
Change-Id: Ie0c5ddf1cc1ab4268838f3ea18ca2410cfe6d698
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220497
Reviewed-by: Joe Tsai <joetsai@google.com>
The eventual home of this is the gRPC repo, but extract it from the
APIv2 repo for now.
Change-Id: I0d88659945e17887da117ab6511e478598e70f02
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220354
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
The MessageV1 and MessageV2 functions convert to/from the v1 and v2
message interfaces.
The MessageReflect function provides a reflective view over message.
These functions do not have an "Of" suffix to be consistent with
the existing MessageName and MessageType functions.
Furthermore, we drop the "Of" suffix from functions in the descriptor
package to be consistent. This is a safe change since none of those
functions have seen a stable release.
We move the descriptor.GeneratedXXX types to the proto package
for documentation purposes.
Fixes#956
Change-Id: I566b74367798e2e3399db9902b58ffeb673199ca
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219137
Reviewed-by: Damien Neil <dneil@google.com>
All functionality has been re-written to either wrap v2 directly
(e.g., binary serialization) or written to use v2 protobuf reflection
(e.g., text and json serialization). This is to done to reduce the
technical debt of maintaining the v1 module.
Change-Id: I6749fa58a465df991c8fcf89e8d7077d64a2cfdb
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/213901
Reviewed-by: Damien Neil <dneil@google.com>
go get -u google.golang.org/protobuf/...
Fixes deadlock in tests by picking up CL 205957.
Change-Id: I9eda29602238c6ba4053f269e35304934bb909f5
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/205997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>