1067 Commits

Author SHA1 Message Date
Singee
70db1e1de2 encoding/protojson: ignore unknown enum name if DiscardUnknown=true
This makes encoding/protojson pass all protobuf conformance tests.

Other Similar CL:
  - https://go-review.googlesource.com/c/protobuf/+/350469
  - https://go-review.googlesource.com/c/protobuf/+/256677

Fixes golang/protobuf#1208

Change-Id: I9f74162b80a3c7ee4750160fc59f0313345046de
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/525535
Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-09-08 10:59:01 +00:00
Joe Tsai
f9212a8dfa all: modernize documentation
Modernize the documentation across the entire module
to make use of the newer ability to linkify declarations.

Change-Id: I440f9a3f025ec6fadfd9cba59b1dfb57028bf3f1
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/309430
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-09-05 14:55:28 +00:00
Josh Humphries
6d0a5dbd95 types/descriptorpb: regenerate using latest protobuf v24.0-rc2 release candidate
This updates all generated code to match the contents of the latest
v24.0-rc2 release candidate of Protobuf. This provides access to the
various new fields and types defined in google/protobuf/descriptor.proto.

Change-Id: I8ec56b308dd7eed52fb9b17b258a45d0669c47ff
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/512795
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-07-27 12:38:59 +00:00
Michael Stapelberg
31694dbe3b types/dynamicpb: make atomicExtFiles the first word of the struct
This fixes a panic (“unaligned 64-bit atomic operation”).

fixes https://github.com/golang/protobuf/issues/1555

Change-Id: I9da73993abff54edc7d4a0ee7287b9d43f5ff766
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/513575
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-07-27 10:22:13 +00:00
Damien Neil
4396dd4cd0 encoding/protodelim: drop TestUnmarshalFromBufioAllocations
This test is failing on at least one architecture.
It's probably too fragile to be worth figuring out;
drop the test entirely.

Fixes golang/protobuf#1554

Change-Id: I9106dbdd12af8719761fd7257b38d4f8584279a6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/512677
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-07-25 06:14:34 +00:00
Lasse Folger
55f120eb3b all: start v1.31.0-devel
Change-Id: Ief1eb5ca950f0382e123ae833a28acc2d76bb8fb
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/506156
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-06-26 11:17:47 +00:00
Lasse Folger
68463f0e96 all: release v1.31.0
Change-Id: Ic67237749015f22a8657b65ad7250a6f95b742b4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/506155
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
v1.31.0
2023-06-26 11:17:38 +00:00
Michael Stapelberg
59a8581684 encoding/protodelim: fix handling of io.EOF
Before this change, when encountering an io.EOF after reading at least
one byte, the zero value byte was — incorrectly — appended to sizeBuf,
and the io.EOF was ignored, resulting in a complete varint (0 has no
continuation bit), which in turn resulted in incorrect unmarshalling.

Change-Id: If06d45039d998eaddf91d0864814bb31d4cb7ae0
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/505555
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-06-26 07:38:07 +00:00
yahuichen
fc47fdd3d3 proto: store the size of tag to avoid multiple calculations
Change-Id: I001c2c6996e92d69234431f3463b5558840da948
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/500695
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-06-06 12:13:21 +00:00
Michael Stapelberg
cc524c9cf1 internal/order: fix sorting of synthetic oneofs to be deterministic
Before this change, synthetic oneofs were ignored in the inOneof() helper
function, but not in the remainder of the LegacyFieldOrder function.

Change-Id: Ia60e5244ae1000e98bbba9dd26f1d1583337fab4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/497935
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
2023-05-25 07:36:46 +00:00
Vanja Pejovic
b8fc770601 encoding/protodelim: If UnmarshalFrom gets a bufio.Reader, try to reuse its buffer instead of creating a new one
When unmarshalling many messages, this reduces the amount of memory allocated and saves CPU time.

Change-Id: I440b8b223319ba2ed31ce559c125b1d640d5880c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/491596
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-08 20:37:08 +00:00
Cody Schroeder
cf06b0c33c compiler/protogen: add Semantic.SET to setter annotations
Provide an API to add the GeneratedCodeInfo.Annotation.Semantic enum to
annotations.

Change-Id: I92ab30619a94a117679a0eb16d8cb5b3a1352586
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/489795
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-01 15:43:20 +00:00
Edward McFarlane
05cbe34333 encoding: add MarshalAppend to protojson and prototext
Adds MarshalAppend methods to allow for byte slices to be reused.
Copies signature from the binary encoding.

Small changes to internal json and text libraries to use strconv
AppendInt and AppendUint for number encoding.

Change-Id: Ife7c8979c1c153a0a0bf9b70b296b8158d38dffc
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/489615
Reviewed-by: Edward McFarlane <emcfarlane000@gmail.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-01 15:10:15 +00:00
Damien Neil
1bca6d9b7d types/dynamicpb: add NewTypes
Add a function to construct a dynamic type registry from a
protoregistry.Files. The NewTypes constructor takes a concrete
Files to permit future improvements based on changes to Files.
(For example, we might add a Files.FindExtensionByNumber
method, which Types could take advantage of.)

Fixes golang/protobuf#1216

Change-Id: I61edba0a94528829d40f69fad773ccb5912859e0
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/489316
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2023-04-28 07:55:56 +00:00
Damien Neil
736947c4de all: update protobuf release version to fix macOS tests
Update to a protobuf version that contains a fix for
https://github.com/protocolbuffers/protobuf/issues/12173
(macOS build error).

Set "CC=clang" when building the protobuf repo on macOS,
which fixes build errors on my machine (macOS 13.3.1, M1).

Change-Id: Id8abb054479454b7ccbded5a6fa4d74f3d3c236d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/489315
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-04-26 20:34:47 +00:00
Lasse Folger
808c66411f all: start v1.30.0-devel
Change-Id: I36d043a08b60783360dfca21f100b697fe7e3e8d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/476836
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-03-16 08:33:08 +00:00
Lasse Folger
f221882bfb all: release v1.30.0
Change-Id: I065812c6b762f58d5c9d76689b81dea1e7082e2a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/476835
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
v1.30.0
2023-03-16 08:32:54 +00:00
Abhilash Pallerlamudi
e344383da6 protoadapt: helper functions to convert v1 or v2 message to either v1 or v2 message.
Fixes golang/protobuf#1442

Change-Id: I7ec60982be81d5dc060094ccec51d819b17a3a8f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/449576
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-03-15 15:17:00 +00:00
Lasse Folger
32efccd158 all: start v1.29.1-devel
Change-Id: Ie844955201027d59486a14e2470ffbac5bce5da8
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/475877
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-03-14 09:32:35 +00:00
Lasse Folger
771d8c7a1e all: release v1.29.1
Change-Id: Ib054f406292d9f2f37e9225d7dd81c65511f43af
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/475876
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-03-14 09:32:20 +00:00
Damien Neil
edaf511a7a internal/encoding/text: fix parsing of incomplete numbers
Fix a panic when parsing the incomplete negative number "- ".

Fixes golang/protobuf#1530

Change-Id: Iba5e8ee68d5f7255c28f1a74f31beee36c9ed847
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/475995
Reviewed-by: Lasse Folger <lassefolger@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
2023-03-14 07:09:30 +00:00
Lasse Folger
fe5bc54041 all: start v1.29.0-devel
Change-Id: I543d164519c1f8a095f9d8975213b182b3067f20
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/474436
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-03-08 15:36:41 +00:00
Lasse Folger
d3c9826520 all: release v1.29.0
Change-Id: Ieb49f0086eddc141eb0d13c749474803d22354d4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/474435
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-03-08 15:33:56 +00:00
googleberg
eba8b0975f cmd/protoc-gen-go: support protobuf retention feature
This change strips out all descriptor option fields marked with [retention = RETENTION_SOURCE] before writing the FileDescriptor to the generated go code bindings.

Change-Id: Ie624d9d4b4f211a256661d80a04199ae8401662b
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/472696
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-03-07 09:24:00 +00:00
Josh Humphries
fcf5f6cb72 encoding/prototext: allow whitespace and comments between minus sign and number in negative numeric literal
The text format specification[1] indicates that whitespace and comments
may appear after a minus sign and before the subsequent numeric component
in negative number literals. But the Go implementation does not allow
this.

This brings the Go implementation info conformance with this aspect.

Fixes golang/protobuf#1526

[1] https://protobuf.dev/reference/protobuf/textformat-spec/#parsing

Change-Id: I3996c89ee9d37cf2b7502fc6736d6e2ed6dbcf43
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/473015
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-03-06 07:33:04 +00:00
Josh Humphries
bc1253ad37 types/descriptorpb: regenerate using latest protobuf v22.0 release
This updates all generated code to match the contents of the latest
v22.0 release of Protobuf.

This involved a couple of changes to the script that does the sync'ing:
  1. The new Protobuf version no longer includes autoconf configuration
     and instead requires using bazel to build things.
  2. The new Protobuf release does not have an artifact named
     "protobuf-all-${VERSION}.tar.gz", but the one named
     "protobuf-${VERSION}.tar.gz" has all of the sources and was
     sufficient for the regenerate.bash script to complete.

This change does NOT regenerate the protos related to benchmarks.
The Protobuf repo no longer includes benchmarks. The CL removing them
says they are superceded by google/fleetbench:
    83c499de86
But that project's proto benchmark files are very different:
    https://github.com/google/fleetbench/tree/main/fleetbench/proto
So I commented out those steps in the generation code since the benchmarks
will need some work to reconcile with fleetbench.

This code adds known failing tests for conformance. New test cases were
added in https://github.com/protocolbuffers/protobuf/pull/9534, but the
Go protojson package does not behave according to the new tests. There
is an existing issue in GitHub about this:
    https://github.com/golang/protobuf/issues/1208

Change-Id: Iad796ec7889bc2a74b58db5224facf850cd1a1cd
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/469255
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-02-22 09:33:03 +00:00
Oleksandr Redko
246af0d153 internal,reflect: correct typos
Fix typos in comments and unexported function name.

Change-Id: I239fff85bc68d7f0ef6f8853acdc9bbe19d86304
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/466535
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2023-02-09 09:27:51 +00:00
Oleksandr Redko
49eaa78c6c all: update links to Protocol Buffer documentation
https://developers.google.com/protocol-buffers/ states that
this site will be deprecated January 2023 and provides
https://protobuf.dev/ as a link to the new location.

Generated .pb.go files are created by generate.bash using Go 1.18,
so leave them unchanged for now.

Fixes golang/protobuf#1520.

Change-Id: I1ddf6f329c96ba05d7c7d8562ad2945f479ee09b
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/466375
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-02-08 13:52:20 +00:00
Christian Höppner
e831c33179 proto: document Equal behavior of invalid messages
The doc comment of proto.Equal now explicitly describes the behavior
in the case when one message is valid and other is invalid.

Change-Id: Ifeba40277c7da25193d46ad496e910f9b63eb795
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/464275
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Chressie Himpel <chressie@google.com>
2023-02-07 08:52:30 +00:00
Pontus Leitzler
358fe40267 internal/strs: avoid unnecessary allocations in Builder
The grow() method in func did create a new internal byte slice with a
specific size instead of a specific capacity. As the call following
grow() is append() we ended up with a slice larger than needed.

It affects the memory consumption of programs that import generated
protobuf files. As an example with the following:

-- go.mod --
module x

go 1.20

require cloud.google.com/go/appengine v1.6.0
-- main.go --
package main

import _ "cloud.google.com/go/appengine/apiv1/appenginepb"

func main() {}

Running the following a few times:
$ go mod tidy && GODEBUG=inittrace=1 go run . 2>&1 | grep appenginepb

Before:
init cloud.google.com/go/appengine/apiv1/appenginepb @3.4 ms, 0.23 ms clock, 204624 bytes, 231 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @3.2 ms, 0.17 ms clock, 204688 bytes, 231 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @2.5 ms, 0.15 ms clock, 204400 bytes, 230 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @2.5 ms, 0.16 ms clock, 205552 bytes, 234 allocs

After:
init cloud.google.com/go/appengine/apiv1/appenginepb @3.3 ms, 0.19 ms clock, 143440 bytes, 226 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @2.7 ms, 0.16 ms clock, 144368 bytes, 229 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @2.8 ms, 0.16 ms clock, 144304 bytes, 229 allocs
init cloud.google.com/go/appengine/apiv1/appenginepb @3.1 ms, 0.16 ms clock, 142864 bytes, 224 allocs

Change-Id: If4ece5d70d6bd9de8a758cb29ce9dffc741c4951
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/465115
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-02-06 09:03:56 +00:00
Noriaki
0430d694e0 internal/impl: remove the unreachable line of code
Change-Id: Ie929703894858848c8465e0889d4fab04c1facc9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/463795
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-01-30 09:33:22 +00:00
Michael Stapelberg
a9481185b3 cmd/protoc-gen-go: make deprecated messages more descriptive
Also respect the file-wide deprecation option by treating every
identifier within the file as deprecated.

Change-Id: Ic3a5e84c2d90bbcbefc0a1b3272cc50554b94218
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/462315
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-01-18 09:34:59 +00:00
Samuel Benzaquen
31a5920811 protobuf: remove the check for reserved field numbers.
Field numbers in the reserved range are semantically valid,
although the protocol buffer compiler may reject attempts to
define fields in this range.

Change-Id: Ib939ed5f4fef09b29047b509829b2f01494bfb6a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/461238
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-01-12 08:45:15 +00:00
Mikhail Mazurskiy
a8d446d548 types/known/structpb: preallocate map in AsMap
Change-Id: I4fe676418959c23055e91d99a07ee3be8d466e25
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/460215
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2023-01-05 08:17:12 +00:00
Joe Tsai
b2a7dfe48b reflect/protoreflect: add Value.Equal method
The Value.Equal method compares Values in a way that is
analogous to the reflect.DeepEqual function.

Most of the implementation is moved from the "proto" package,
with proto.Equal implemented in terms of protoreflect.Value.Equal.

Change-Id: Ie9d5f6c073dc49fa59f78385c441db8137de5ec5
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/450775
TryBot-Bypass: Heschi Kreinick <heschi@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Oleksii Prokopchuk <prokopchuk@google.com>
Reviewed-by: Christian Höppner <hoeppi@google.com>
Run-TryBot: Lasse Folger <lassefolger@google.com>
2022-12-01 15:36:18 +00:00
Damien Neil
f0e23c7a8f proto: revert expose package-private equalField
This reverts commit 4d6d2135eba33eaef1c020129188ce7e82aa4270.

Post-submit discussion on CL 448876 suggests that this API should
change; revert it pending a decision.

Change-Id: I2e81be847c62ea7de5dfef36bb10ab193132e612
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/450955
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Run-TryBot: Lasse Folger <lassefolger@google.com>
TryBot-Bypass: Michael Stapelberg <stapelberg@google.com>
2022-11-16 08:31:27 +00:00
Oleksii Prokopchuk
4d6d2135eb proto: expose package-private equalField.
There is a demand for comparing protobuf.Value-s.
One use case is when one wants to compare just one field via reflection.
Another is when one wants to iterate over fields and check for diffs.
Existing diff packages are recommended only for tests as they panic on error.
Exposing equalField will prevent excessive branching of proto/equal.go code.

Change-Id: Iec8843dae96c9ae3c45858e8b97e7aa963473ce2
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/448876
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Run-TryBot: Michael Stapelberg <stapelberg@google.com>
TryBot-Bypass: Michael Stapelberg <stapelberg@google.com>
2022-11-14 16:01:29 +00:00
Michael Stapelberg
7a48e2b662 protoreflect: fix list example code
Change-Id: I2c8afba104ae97be5e575226a47f6a7f20198abe
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/431798
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
2022-09-20 08:06:00 +00:00
Michael Stapelberg
494e81bd5a integration test: drop Go 1.11 and Go 1.12
fixes https://github.com/golang/protobuf/issues/1483

Change-Id: Ia5235f5923bc2430213d38bf5c6c5d0bcf25fa24
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/430516
Run-TryBot: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
2022-09-13 14:25:03 +00:00
Joe Tsai
f930b1dc76 encoding/protojson: fix parsing of google.protobuf.Timestamp
The Timestamp message uses a subset of RFC 3339.
RFC 3339, section 5.6 specifies that the subsecond field can have
any non-zero number of digits.
On the other hand, the protobuf documentation specifies that Timestamp
uses RFC 3339 with a few restrictions. In other words,
protobuf does NOT use RFC 3339, but rather a subset of it.

An upstream change https://go.dev/cl/425037 modifies the time package
to be internally consistent about handling of extra subsecond digits
allowing it to be more in line with RFC 3339.

Make a corresponding change here to ensure we remain compliant
with protobuf's restricted use of RFC 3339.

Change-Id: Ic145c68492fb41a5f7b79b653f3246dd9091d5d8
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/425554
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-08-31 09:28:52 +00:00
Josh Humphries
692f4a24f8 types/descriptorpb: update *.pb.go to use latest protoc release, 21.5
I updated the protoc version to 21.5 and ran regenerate.bash.

This updates the various *.pb.go files to use the sources from
the latest protobuf release. In particular, this updates the
descriptorpb, so it includes some changes to descriptor.proto
in the past year and a half since this was last re-generated.
The change also pulled over several other generated changes.

Change-Id: Icd9c4e5d47ba85e1f4bae1d0a025f8dec15a3014
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/426054
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-08-27 06:10:12 +00:00
Sachin Padmanabhan
fb0abd9158 encoding: add protodelim package
Fixes golang/protobuf#1382

Change-Id: I30dc9bf9aa44e35cde8fb472c3b8b116d459714e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/419254
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2022-08-02 22:27:24 +00:00
Lasse Folger
0f853484d7 all: start v1.28.1-devel
Change-Id: Ifa2563ae4661a99deaf015533d98413a38365797
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/419935
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2022-07-28 12:39:36 +00:00
Lasse Folger
6875c3d724 all: release v1.28.1
Change-Id: I2987633792a1429079cfebdf4c03d5629e4a448a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/419934
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
v1.28.1
2022-07-28 12:39:19 +00:00
Lasse Folger
881da6ece0 all: Add prebuild binaries for arm64
Change-Id: Ia8a0e2cce7a33c50d0064cb67a4e1c669cf8569b
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/419714
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-07-28 06:45:07 +00:00
Russ Cox
2a74a0e823 A+C: delete AUTHORS and CONTRIBUTORS
In 2009, Google's open-source lawyers asked us to create the AUTHORS
file to define "The Go Authors", and the CONTRIBUTORS file was in
keeping with open source best practices of the time.

Re-reviewing our repos now in 2022, the open-source lawyers are
comfortable with source control history taking the place of the
AUTHORS file, and most open source projects no longer maintain
CONTRIBUTORS files.

To ease maintenance, remove AUTHORS and CONTRIBUTORS from all repos.

For #53961.

Change-Id: I6f3becd863672356de571303ff31434f517d959e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/418902
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-07-22 15:52:47 +00:00
Damien Neil
de9682ad16 internal/impl: improve MessageInfo.New performance
Calling the ProtoReflect method of the newly-constructed
message avoids an allocation in MessageInfo.MessageOf in
the common case of a generated message with an optimized
ProtoReflect method.

Benchmark for creating an empty message, darwin/arm64 M1 laptop:

    name                 old time/op    new time/op    delta
    EmptyMessage/New-10    32.1ns ± 2%    23.7ns ± 2%  -26.06%  (p=0.000 n=10+9)

    name                 old alloc/op   new alloc/op   delta
    EmptyMessage/New-10     64.0B ± 0%     48.0B ± 0%  -25.00%  (p=0.000 n=10+10)

    name                 old allocs/op  new allocs/op  delta
    EmptyMessage/New-10      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Change-Id: Ifa3c3ffa8edc76f78399306d0f4964eae4aacd28
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/418677
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-07-21 16:01:25 +00:00
Damien Neil
b0a944684d all: reformat with go1.19 gofmt
Apply go1.19 gofmt to non-generated files.

Generated .pb.go files are created by generate.bash using Go 1.18,
so leave them unchanged for now.

Change-Id: Ied36c83cf99704988d059bf0412e677f0fbc71b0
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/418676
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-07-21 16:01:13 +00:00
Damien Neil
c1bbc5d45b all: make integration test work on darwin/arm64
Skip tests with Go versions prior to 1.16.

Bump test version for Go 1.17 and 1.18 to latest.

Change-Id: I740bbc63bf35362fcfad3cf0e07ea4bd0ee56748
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/418675
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-07-21 15:59:32 +00:00
Damien Neil
5f429f7042 proto: fix compilation failure in tests
Change-Id: I61a84dffcf4ccc9f81dc8b9f932c315713e81142
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/418674
Reviewed-by: Lasse Folger <lassefolger@google.com>
2022-07-21 06:22:01 +00:00