Граф коммитов

799 Коммитов

Автор SHA1 Сообщение Дата
lfolger 75de7c059e
Merge pull request #1597 from golang/updatedesc
all: update descriptor.proto to latest version
2024-03-06 07:45:40 +01:00
Damien Neil b7697bb698 all: update descriptor.proto to latest version
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
2024-03-05 14:04:10 -08:00
Damien Neil 5d5e8c018a
Merge pull request #1363 from neild/jsonnull
jsonpb: accept 'null' as a valid representation of NullValue in unmarshal
2021-09-15 17:37:10 -07:00
Damien Neil 37828f9622 jsonpb: accept 'null' as a valid representation of NullValue in unmarshal
The canonical JSON representation for NullValue is JSON "null".

Fixes github.com/golang/protobuf#1361.
2021-09-15 16:28:59 -07:00
Joe Tsai ae97035608
all: deprecate the module (#1306)
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.
2021-03-29 11:20:59 -07:00
Krzysztof Dryś af940030a2
jsonpb: restore previous behavior for handling nulls and JSONPBUnmarshaler (#1300)
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.
2021-03-24 11:44:03 -07:00
Joe Tsai a36a1a1c34
all: depend on google.golang.org/protobuf@v1.26.0 (#1293) 2021-03-17 18:16:33 -07:00
Joe Tsai f746d3b8ec
all: depend on google.golang.org/protobuf@v1.26.0-rc.1 (#1292) 2021-03-17 17:15:31 -07:00
Joe Tsai 78b1f09b43
Switch from Travis-CI to GitHub actions (#1286)
Travis-CI is dead. GitHub actions is the new hotness.
The minimally supported version is Go1.11 to make use of modules.
2021-03-03 09:36:43 -08:00
Joe Tsai acacf8158c
all: rely on protodesc.ToFileDescriptorProto (#1214)
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.
2021-03-02 17:38:46 -08:00
Joe Tsai eccd77d6ff
ptypes: deprecate the package (#1217)
Deprecate the ptypes package since all the equivalent functionality
is now directly generated with the well-known types themselves.
2021-03-02 17:35:02 -08:00
Herbie Ong 4846b58453
jsonpb: Fix marshaling of Duration (#1221)
Negative nanosecond should not have negative sign after decimal point.
Add check for max and min seconds.

Fixes #1219.
2020-10-14 23:18:29 -07:00
Joe Tsai 91c84e0db1
travis.yml: update tested versions of Go (#1211)
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.
2020-09-24 17:55:37 -07:00
Christian Persson 3860b2764f
proto: convert integer to rune before converting to string (#1210)
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.
2020-09-24 14:05:11 -07:00
Joe Tsai d04d7b157b
all: upgrade to google.golang.org/protobuf@v1.23.0 (#1131) 2020-05-14 13:44:37 -07:00
Joe Tsai 07c14f1089
proto: make InternalMessageInfo functional (#1129)
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.
2020-05-14 12:59:40 -07:00
Isaac Schwabacher 00998c7dd9
jsonpb: fix a confusing error message (#1125)
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.
2020-05-11 16:05:48 -07:00
Joe Tsai 6c66de79d6
all: upgrade to google.golang.org/protobuf@v1.22.0 (#1114) 2020-05-04 12:38:55 -07:00
Joe Tsai b5de78c91d
all: minor documentation adjustments (#1112) 2020-05-04 12:14:45 -07:00
Joe Tsai 8d9af28540
protoc-gen-go/grpc: make grpc identical to v1.3.5 (#1113)
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
2020-05-04 12:07:49 -07:00
Marcel Lanz fa093f5948
proto: fix stale deprecation documentation on registry functions (#1093)
The documentation unfortunately refers to old declarations that were changed during the development of the `google.golang.org/protobuf` module.
2020-04-19 13:26:30 -07:00
Joe Tsai 1b794fe86d
all: upgrade to google.golang.org/protobuf@v1.21.0 (#1081) 2020-04-13 12:43:07 -07:00
Damien Neil e9dc0d72c1 all: update to wrap google.golang.org/protobuf
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.
2020-04-13 10:33:58 -07:00
Joe Tsai 3a3cefd0f2
all: use google.golang.org/protobuf/testing/protopack for tests (#1063)
Use protopack for tests instead of hard-coded binary data.
2020-03-20 15:00:05 -07:00
Joe Tsai c8ad4533e5
all: use google.golang.org/encoding/protowire (#1062)
Use the exported protowire package instead of an internal fork.
2020-03-20 14:52:42 -07:00
Joe Tsai 7592abeb96
internal/cmd/generate-alias: fix for lacking go_package options (#1061)
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.
2020-03-20 14:41:29 -07:00
Joe Tsai b860323f09
proto: inline the implementation of protoimpl.X.ExtensionDescFromType (#1056) 2020-03-13 16:19:45 -07:00
Damien Neil 84668698ea
go.mod: set go version to go1.9 (#1055) 2020-03-12 15:07:03 -07:00
Joe Tsai 7bd8073ff0 proto: use fixed UnmarshalState API
Change-Id: I08abfaed1bafd0d650988883be31faefbd312331
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/222679
Reviewed-by: Damien Neil <dneil@google.com>
2020-03-09 20:21:52 +00:00
Damien Neil 3f90b7282e all: use google.golang.org/protobuf v1.20.0
Change-Id: Ib6c3a09e41548008897bacd54aa8fc6939ea8350
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221786
Reviewed-by: Herbie Ong <herbie@google.com>
2020-03-02 19:47:53 +00:00
Joe Tsai a3619c1aca all: use new protogen options API
Change-Id: Ib7ef4f9e8a6b7ada1f0cba4ae706be9fb8f7a10c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/221559
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-28 23:19:22 +00:00
Joe Tsai d935ec2d86 all: update README.md
Change-Id: I60d9ccf1685e2e30327b5a4daf3c65b540c51e88
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220679
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-28 21:47:37 +00:00
Joe Tsai c343881f72 CONTRIBUTING.md: swap revision with version
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>
2020-02-26 19:42:34 +00:00
Damien Neil 5d5b4c10bd
ptypes: regenerate with v3.11.4, update for go1.14 gofmt (#1045)
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.
2020-02-26 11:23:50 -08:00
Joe Tsai b1b17f0ead all: cleanup protoimpl calls
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>
2020-02-25 21:03:34 +00:00
Joe Tsai 97960cd98a jsonpb: use CheckInitialized
Change-Id: Id2ba5826577960f283a90a766435353e6399c060
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220687
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-25 18:48:51 +00:00
Joe Tsai ad065b88f3 ptypes: UnmarshalAny with non-pointer DynamicMessage
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>
2020-02-25 18:48:35 +00:00
Joe Tsai d8aac26686 proto, jsonpb: fix handling of extensions
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>
2020-02-25 10:26:24 +00:00
Joe Tsai a9f2576955 proto: add text tests
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>
2020-02-25 10:21:42 +00:00
Joe Tsai 1a45e6b3bb all: add CONTRIBUTING.md
Change-Id: I3fcf268e35159e89beacf1ec63dfc256477a6382
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220678
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-24 23:30:58 +00:00
Joe Tsai 67d41d38c2 proto: use CheckInitialized instead of IsInitialized
Change-Id: Idc03fc0c7afd81a69fcd6120c9472c9bc68ead4d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220346
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-21 23:46:24 +00:00
Joe Tsai c45dae45a6 proto: use UnmarshalState
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>
2020-02-21 23:35:50 +00:00
Damien Neil 4767034811 protoc-gen-go: drop golden test
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>
2020-02-21 19:12:14 +00:00
Damien Neil cea45d6ceb protoc-gen-go: move gengogrpc into v1 repo
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>
2020-02-21 17:28:03 +00:00
Joe Tsai 0fd14f9610 proto: add MessageV1, MessageV2, and MessageReflect
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>
2020-02-12 18:09:08 +00:00
Joe Tsai f5a698d60c proto: add ProtoPackageIsVersion4
Change-Id: I73a3da6d46e82c4c996ad9360e5b602efbbbcc83
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/218938
Reviewed-by: Damien Neil <dneil@google.com>
2020-02-11 00:11:57 +00:00
Doug Fawley d23c5127dc grpc: accept interface in NewClient functions (#1025)
* grpc: accept interface in NewClient functions

* fix deprecated.pb.go and grpc_empty.pb.go

* add go.mod and go.sum to testdata/grpc

* remove comment
2020-01-28 10:10:22 -08:00
Daniel Saavedra 4e55bbcbfa Update readme.md (#988)
Update readme.md to be more clearly visually the install comand and easier to copy pasta
2020-01-11 17:27:37 -08:00
Joe Tsai cc376d7145 all: update to wrap v2
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>
2020-01-09 19:10:17 +00:00
Damien Neil ff0ab7ff11 go.mod: update to latest google.golang.org/protobuf
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>
2019-11-08 00:43:44 +00:00