Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: protocolbuffers/protobuf-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.36.5
Choose a base ref
...
head repository: protocolbuffers/protobuf-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.36.6
Choose a head ref
  • 7 commits
  • 157 files changed
  • 3 contributors

Commits on Feb 6, 2025

  1. all: start v1.36.5-devel

    Change-Id: I68c163ac7ac8fb75e88a5ce8b0c83b3869b54e3e
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/647156
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Chressie Himpel <chressie@google.com>
    stapelberg committed Feb 6, 2025
    Copy the full SHA
    1719d63 View commit details

Commits on Feb 13, 2025

  1. all: set Go language version to Go 1.22

    Go 1.24 was released recently.
    
    Change-Id: I4e2c83c6cc90a3c7e996f8e6ba6ee7f8589596ee
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/649135
    Reviewed-by: Chressie Himpel <chressie@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    stapelberg committed Feb 13, 2025
    Copy the full SHA
    9c8c2dd View commit details

Commits on Mar 5, 2025

  1. types/descriptorpb: regenerate using latest protobuf v30 release

    The changes to integration_test.go and internal/filedesc/editions.go
    were manual, the rest is the result of ./regenerate.bash.
    
    Note that while Protobuf v30 supports Bazel 8, the targets we need
    ("test and release targets") still require Bazel 7. An easy way
    to work with Bazel 7 is to use bazelisk:
    
    mkdir /tmp/wrap
    cat > /tmp/wrap/bazel <<'EOT'
    USE_BAZEL_VERSION=7.x bazelisk "$@"
    EOT
    chmod +x /tmp/wrap/bazel
    export PATH=/tmp/wrap:$PATH
    ./regenerate.bash
    
    Change-Id: Idfa8d149995025ec5194711ca60648cee50b0766
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/654955
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Chressie Himpel <chressie@google.com>
    stapelberg committed Mar 5, 2025
    Copy the full SHA
    f7fcf5b View commit details

Commits on Mar 17, 2025

  1. proto: Add CloneOf[M Message](m M) M

    This allows writing:
      `copy := proto.CloneOf(orig)`
    instead of the previous:
      `copy := proto.Clone(orig).(*pb.MyMessage)`
    
    Fixes golang/protobuf#1594
    
    Change-Id: I7b8b712b6e59607ccc339720ee3c146e8a7ea28b
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/653536
    Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
    Reviewed-by: Michael Stapelberg <stapelberg@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Jille authored and stapelberg committed Mar 17, 2025
    Copy the full SHA
    4247b1b View commit details

Commits on Mar 20, 2025

  1. internal_gengo: generate a const string literal for the raw descriptor

    Putting the raw descriptor into a const string literal has been
    attempted before (go.dev/cl/638135), but that change has been reverted
    (go.dev/cl/642857) because the generated string contained non-UTF-8
    bytes.
    
    This time we let the %q formatting verb handle the conversion of the
    bytes into a UTF-8-conform string literal.
    
    We also found an interesting way to split the bytes into multiple
    "lines": We use the fact that FileDescriptorProto (and some
    submessages) have a LEN encoded field (string) with field_number=1,
    so splitting at 0x0a (incidentally a newline character in ascii)
    we get a splitting that almost looks readable.
    
    As expected, the const string literals are landing in .rodata.
    
        % (go test -c google.golang.org/protobuf/internal/reflection_test &&
           strings -tx reflection_test.test | grep -F '2&.goproto.proto.testeditions.ImportEnumB' &&
           readelf -SW reflection_test.test | grep -F .rodata)
         321b07 2&.goproto.proto.testeditions.ImportEnumB
           [ 2] .rodata           PROGBITS        000000000065a000 25a000 131fc1 00   A  0   0 32
    
    Change-Id: I77aef7b5032e52c2c485cf662045c9028549fd94
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/657895
    Commit-Queue: Michael Stapelberg <stapelberg@google.com>
    Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
    Reviewed-by: Nicolas Hillegeer <aktau@google.com>
    Reviewed-by: Michael Stapelberg <stapelberg@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    chressie authored and stapelberg committed Mar 20, 2025
    Copy the full SHA
    9f3ed37 View commit details
  2. gha-ci: instruct bazelisk to use Bazel 7.x

    I noticed that our GitHub Actions CI started failing recently.
    This change fixes the issue by sticking to Bazel 7.x.
    
    Change-Id: Iab8b27512e526c2b204421b83a87241827c4aad4
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/659495
    Reviewed-by: Chressie Himpel <chressie@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    stapelberg committed Mar 20, 2025
    Copy the full SHA
    a5da9b2 View commit details

Commits on Mar 24, 2025

  1. all: release v1.36.6

    Change-Id: I243fc05412297e360b019555fd15176b8bc52ce6
    Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/660315
    Reviewed-by: Chressie Himpel <chressie@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    stapelberg committed Mar 24, 2025
    Copy the full SHA
    3f79c52 View commit details
Showing with 10,621 additions and 27,049 deletions.
  1. +2 −2 .github/workflows/test.yml
  2. +16 −15 cmd/protoc-gen-go/internal_gengo/reflect.go
  3. +7 −21 cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
  4. +16 −30 cmd/protoc-gen-go/testdata/comments/comments.pb.go
  5. +8 −19 cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
  6. +17 −28 cmd/protoc-gen-go/testdata/enumprefix/enumprefix.pb.go
  7. +7 −19 cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
  8. +63 −320 cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
  9. +5 −15 cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
  10. +40 −209 cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
  11. +33 −56 cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
  12. +7 −29 cmd/protoc-gen-go/testdata/import_public/a.pb.go
  13. +6 −22 cmd/protoc-gen-go/testdata/import_public/b.pb.go
  14. +6 −24 cmd/protoc-gen-go/testdata/import_public/c.pb.go
  15. +26 −53 cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go
  16. +4 −13 cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go
  17. +4 −14 cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go
  18. +4 −11 cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
  19. +9 −15 cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
  20. +4 −12 cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go
  21. +4 −12 cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go
  22. +4 −12 cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go
  23. +4 −13 cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go
  24. +4 −13 cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go
  25. +6 −17 cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go
  26. +6 −17 cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go
  27. +11 −45 cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go
  28. +6 −15 cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go
  29. +90 −122 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_hybrid/test_name_clash_hybrid.pb.go
  30. +90 −122 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_hybrid/test_name_clash_hybrid_protoopaque.pb.go
  31. +92 −216 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_hybrid3/test_name_clash_hybrid3.pb.go
  32. +92 −216 ...rotoc-gen-go/testdata/nameclash/test_name_clash_hybrid3/test_name_clash_hybrid3_protoopaque.pb.go
  33. +90 −122 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_opaque/test_name_clash_opaque.pb.go
  34. +92 −216 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_opaque3/test_name_clash_opaque3.pb.go
  35. +49 −76 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_open/test_name_clash_open.pb.go
  36. +51 −128 cmd/protoc-gen-go/testdata/nameclash/test_name_clash_open3/test_name_clash_open3.pb.go
  37. +9 −13 cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
  38. +25 −43 cmd/protoc-gen-go/testdata/proto2/enum.pb.go
  39. +144 −374 cmd/protoc-gen-go/testdata/proto2/fields.pb.go
  40. +9 −24 cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
  41. +6 −16 cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
  42. +7 −14 cmd/protoc-gen-go/testdata/proto3/enum.pb.go
  43. +54 −153 cmd/protoc-gen-go/testdata/proto3/fields.pb.go
  44. +29 −52 cmd/protoc-gen-go/testdata/protoeditions/enum.pb.go
  45. +140 −393 cmd/protoc-gen-go/testdata/protoeditions/fields.pb.go
  46. +15 −32 cmd/protoc-gen-go/testdata/protoeditions/legacy_enum.pb.go
  47. +21 −70 cmd/protoc-gen-go/testdata/protoeditions/maps_and_delimited.pb.go
  48. +9 −28 cmd/protoc-gen-go/testdata/protoeditions/nested_messages.pb.go
  49. +13 −50 cmd/protoc-gen-go/testdata/retention/options_message.pb.go
  50. +44 −127 cmd/protoc-gen-go/testdata/retention/retention.pb.go
  51. +1 −1 go.mod
  52. +9 −9 integration_test.go
  53. BIN internal/editiondefaults/editions_defaults.binpb
  54. +3 −0 internal/filedesc/editions.go
  55. +16 −0 internal/genid/descriptor_gen.go
  56. +0 −2 internal/strs/{strings_unsafe_go121.go → strings_unsafe.go}
  57. +0 −94 internal/strs/strings_unsafe_go120.go
  58. +4 −17 internal/testprotos/annotation/annotation.pb.go
  59. +21 −30 internal/testprotos/benchmarks/micro/micro.pb.go
  60. +51 −94 internal/testprotos/conformance/conformance.pb.go
  61. +196 −611 internal/testprotos/conformance/editions/test_messages_edition2023.pb.go
  62. +792 −1,112 internal/testprotos/conformance/editionsmigration/test_messages_proto2_editions.pb.go
  63. +258 −787 internal/testprotos/conformance/editionsmigration/test_messages_proto3_editions.pb.go
  64. +797 −1,053 internal/testprotos/conformance/test_messages_proto2.pb.go
  65. +258 −763 internal/testprotos/conformance/test_messages_proto3.pb.go
  66. +167 −440 internal/testprotos/editionsfuzztest/test2.pb.go
  67. +164 −463 internal/testprotos/editionsfuzztest/test2editions.pb.go
  68. +181 −478 internal/testprotos/editionsfuzztest/test3.pb.go
  69. +161 −476 internal/testprotos/editionsfuzztest/test3editions.pb.go
  70. +14 −19 internal/testprotos/enums/enums.pb.go
  71. +14 −24 internal/testprotos/enums/enums_hybrid/enums.hybrid.pb.go
  72. +14 −24 internal/testprotos/enums/enums_hybrid/enums.hybrid_protoopaque.pb.go
  73. +14 −24 internal/testprotos/enums/enums_opaque/enums.opaque.pb.go
  74. +6 −21 internal/testprotos/examples/ext/extexample.pb.go
  75. +107 −301 internal/testprotos/fieldtrack/fieldtrack.pb.go
  76. +12 −57 internal/testprotos/fuzz/fuzz.pb.go
  77. +23 −87 internal/testprotos/irregular/test.pb.go
  78. +14 −33 internal/testprotos/lazy/lazy_extension_normalized_wire_test.pb.go
  79. +50 −105 internal/testprotos/lazy/lazy_extension_test.pb.go
  80. +21 −41 internal/testprotos/lazy/lazy_hybrid/lazy_tree.hybrid.pb.go
  81. +21 −41 internal/testprotos/lazy/lazy_hybrid/lazy_tree.hybrid_protoopaque.pb.go
  82. +12 −23 internal/testprotos/lazy/lazy_normalized_wire_test.pb.go
  83. +21 −41 internal/testprotos/lazy/lazy_opaque/lazy_tree.opaque.pb.go
  84. +21 −36 internal/testprotos/lazy/lazy_tree.pb.go
  85. +17 −104 internal/testprotos/legacy/legacy.pb.go
  86. +8 −21 internal/testprotos/messageset/messagesetpb/message_set.pb.go
  87. +8 −28 internal/testprotos/messageset/messagesetpb/messagesetpb_hybrid/message_set.hybrid.pb.go
  88. +8 −28 internal/testprotos/messageset/messagesetpb/messagesetpb_hybrid/message_set.hybrid_protoopaque.pb.go
  89. +8 −28 internal/testprotos/messageset/messagesetpb/messagesetpb_opaque/message_set.opaque.pb.go
  90. +18 −60 internal/testprotos/messageset/msetextpb/msetextpb.pb.go
  91. +18 −71 internal/testprotos/messageset/msetextpb/msetextpb_hybrid/msetextpb.hybrid.pb.go
  92. +18 −71 internal/testprotos/messageset/msetextpb/msetextpb_hybrid/msetextpb.hybrid_protoopaque.pb.go
  93. +18 −71 internal/testprotos/messageset/msetextpb/msetextpb_opaque/msetextpb.opaque.pb.go
  94. +35 −96 internal/testprotos/mixed/mixed.pb.go
  95. +24 −48 internal/testprotos/news/news.pb.go
  96. +13 −29 internal/testprotos/order/order.pb.go
  97. +6 −19 internal/testprotos/race/extender/test.pb.go
  98. +5 −14 internal/testprotos/race/message/test.pb.go
  99. +27 −45 internal/testprotos/registry/test.pb.go
  100. +36 −48 internal/testprotos/required/required.pb.go
  101. +36 −54 internal/testprotos/required/required_hybrid/required.hybrid.pb.go
  102. +36 −54 internal/testprotos/required/required_hybrid/required.hybrid_protoopaque.pb.go
  103. +36 −54 internal/testprotos/required/required_opaque/required.opaque.pb.go
  104. +4 −18 internal/testprotos/test/ext.pb.go
  105. +480 −1,539 internal/testprotos/test/test.pb.go
  106. +7 −13 internal/testprotos/test/test_import.pb.go
  107. +4 −11 internal/testprotos/test/test_public.pb.go
  108. +189 −502 internal/testprotos/test3/test.pb.go
  109. +189 −524 internal/testprotos/test3/test3_hybrid/test.hybrid.pb.go
  110. +189 −524 internal/testprotos/test3/test3_hybrid/test.hybrid_protoopaque.pb.go
  111. +7 −16 internal/testprotos/test3/test3_hybrid/test_import.hybrid.pb.go
  112. +7 −16 internal/testprotos/test3/test3_hybrid/test_import.hybrid_protoopaque.pb.go
  113. +189 −524 internal/testprotos/test3/test3_opaque/test.opaque.pb.go
  114. +7 −16 internal/testprotos/test3/test3_opaque/test_import.opaque.pb.go
  115. +54 −317 internal/testprotos/test3/test_extension.pb.go
  116. +7 −14 internal/testprotos/test3/test_import.pb.go
  117. +370 −1,194 internal/testprotos/testeditions/test.pb.go
  118. +74 −402 internal/testprotos/testeditions/test_extension.pb.go
  119. +8 −54 internal/testprotos/testeditions/test_extension2.pb.go
  120. +7 −15 internal/testprotos/testeditions/test_import.pb.go
  121. +370 −1,281 internal/testprotos/testeditions/testeditions_hybrid/test.hybrid.pb.go
  122. +370 −1,281 internal/testprotos/testeditions/testeditions_hybrid/test.hybrid_protoopaque.pb.go
  123. +74 −439 internal/testprotos/testeditions/testeditions_hybrid/test_extension.hybrid.pb.go
  124. +74 −439 internal/testprotos/testeditions/testeditions_hybrid/test_extension.hybrid_protoopaque.pb.go
  125. +8 −63 internal/testprotos/testeditions/testeditions_hybrid/test_extension2.hybrid.pb.go
  126. +8 −63 internal/testprotos/testeditions/testeditions_hybrid/test_extension2.hybrid_protoopaque.pb.go
  127. +7 −21 internal/testprotos/testeditions/testeditions_hybrid/test_import.hybrid.pb.go
  128. +7 −21 internal/testprotos/testeditions/testeditions_hybrid/test_import.hybrid_protoopaque.pb.go
  129. +370 −1,281 internal/testprotos/testeditions/testeditions_opaque/test.opaque.pb.go
  130. +74 −439 internal/testprotos/testeditions/testeditions_opaque/test_extension.opaque.pb.go
  131. +8 −63 internal/testprotos/testeditions/testeditions_opaque/test_extension2.opaque.pb.go
  132. +7 −21 internal/testprotos/testeditions/testeditions_opaque/test_import.opaque.pb.go
  133. +197 −365 internal/testprotos/textpb2/test.pb.go
  134. +150 −202 internal/testprotos/textpb3/test.pb.go
  135. +232 −466 internal/testprotos/textpbeditions/test2.pb.go
  136. +231 −499 internal/testprotos/textpbeditions/textpbeditions_hybrid/test2.hybrid.pb.go
  137. +231 −499 internal/testprotos/textpbeditions/textpbeditions_hybrid/test2.hybrid_protoopaque.pb.go
  138. +231 −499 internal/testprotos/textpbeditions/textpbeditions_opaque/test2.opaque.pb.go
  139. +1 −1 internal/version/version.go
  140. +6 −0 proto/merge.go
  141. +10 −0 proto/merge_test.go
  142. +2 −0 reflect/protoreflect/source_gen.go
  143. +0 −2 reflect/protoreflect/{value_unsafe_go121.go → value_unsafe.go}
  144. +0 −98 reflect/protoreflect/value_unsafe_go120.go
  145. +564 −875 types/descriptorpb/descriptor.pb.go
  146. +23 −57 types/gofeaturespb/go_features.pb.go
  147. +7 −17 types/known/anypb/any.pb.go
  148. +23 −60 types/known/apipb/api.pb.go
  149. +7 −18 types/known/durationpb/duration.pb.go
  150. +6 −14 types/known/emptypb/empty.pb.go
  151. +6 −17 types/known/fieldmaskpb/field_mask.pb.go
  152. +6 −18 types/known/sourcecontextpb/source_context.pb.go
  153. +25 −49 types/known/structpb/struct.pb.go
  154. +7 −18 types/known/timestamppb/timestamp.pb.go
  155. +74 −121 types/known/typepb/type.pb.go
  156. +64 −39 types/known/wrapperspb/wrappers.pb.go
  157. +31 −76 types/pluginpb/plugin.pb.go
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -28,6 +28,6 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('integration_test.go') }}
- name: Test
env:
# Protobuf 25 does not yet support Bazel 7
USE_BAZEL_VERSION: latest-1
# Protobuf 30 does not yet support anything newer than Bazel 7
USE_BAZEL_VERSION: 7.x
run: go test -run='^TestIntegration$' -v -timeout=60m -count=1 -failfast "$@"
31 changes: 16 additions & 15 deletions cmd/protoc-gen-go/internal_gengo/reflect.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
package internal_gengo

import (
"bytes"
"fmt"
"math"
"strings"
@@ -242,22 +243,22 @@ func genFileDescriptor(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileI
return
}

g.P("var ", rawDescVarName(f), " = string([]byte{")
for len(b) > 0 {
n := 16
if n > len(b) {
n = len(b)
}

s := ""
for _, c := range b[:n] {
s += fmt.Sprintf("0x%02x,", c)
}
g.P(s)

b = b[n:]
// Generate the raw descriptor as a kind-of readable const string.
// To not generate a single potentially very long line, we use the 0x0a
// byte to split the string into multiple "lines" and concatenate
// them with "+".
// The 0x0a comes from the observation that the FileDescriptorProto,
// and many of the messages it includes (for example
// DescriptorProto, EnumDescriptorProto, etc.), define a string
// (which is LEN encoded) as field with field_number=1.
// That makes all these messages start with (1<<3 + 2[:LEN])=0x0a
// in the wire-format.
// See also https://protobuf.dev/programming-guides/encoding/#structure.
fmt.Fprint(g, "const ", rawDescVarName(f), `=""`)
for _, line := range bytes.SplitAfter(b, []byte{'\x0a'}) {
g.P("+")
fmt.Fprintf(g, "%q", line)
}
g.P("})")
g.P()

if f.needRawDesc {
28 changes: 7 additions & 21 deletions cmd/protoc-gen-go/testdata/annotations/annotations.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 16 additions & 30 deletions cmd/protoc-gen-go/testdata/comments/comments.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 8 additions & 19 deletions cmd/protoc-gen-go/testdata/comments/deprecated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 17 additions & 28 deletions cmd/protoc-gen-go/testdata/enumprefix/enumprefix.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 7 additions & 19 deletions cmd/protoc-gen-go/testdata/extensions/base/base.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading