Skip to content

Commit

Permalink
Update repo so it uses latest protoc 29.1 and protobuf-go 1.36.0 (#399)
Browse files Browse the repository at this point in the history
This supersedes #394 and #396. In order to successfully update to the
latest protobuf-go 1.36.0, we also need to update to the latest v29.1 of
`protoc`.

This removes two validation checks that `protoc` has also removed, in
[#18372](protocolbuffers/protobuf#18372). They
were C++-specific option checks that are now handled by the C++ code-gen
step, not during descriptor production and basic descriptor validation.
So it makes sense for `protocompile` to follow suit and skip these
checks.

This also updates one parser test case where we expected `protocompile`
to succeed but `protoc` to fail, but that is now fixed in the latest
`protoc` (in
[#15017](protocolbuffers/protobuf#15017)).

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
jhump and dependabot[bot] authored Dec 18, 2024
1 parent 12612dc commit 0c5adcf
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .protoc_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
27.0
29.1
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/rivo/uniseg v0.4.7
github.com/stretchr/testify v1.10.0
golang.org/x/sync v0.10.0
google.golang.org/protobuf v1.35.2
google.golang.org/protobuf v1.36.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmarks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/igrmk/treemap/v2 v2.0.1
github.com/jhump/protoreflect v1.14.1 // MUST NOT be updated to v1.15 or higher
github.com/stretchr/testify v1.10.0
google.golang.org/protobuf v1.35.2
google.golang.org/protobuf v1.36.0
)

require golang.org/x/sync v0.10.0
Expand Down
4 changes: 2 additions & 2 deletions internal/benchmarks/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Binary file modified internal/featuresext/cpp_features.protoset
Binary file not shown.
Binary file modified internal/featuresext/java_features.protoset
Binary file not shown.
Binary file modified internal/testdata/all.protoset
Binary file not shown.
Binary file modified internal/testdata/desc_test_complex.protoset
Binary file not shown.
Binary file modified internal/testdata/desc_test_proto3_optional.protoset
Binary file not shown.
Binary file modified internal/testdata/descriptor_impl_tests.protoset
Binary file not shown.
2 changes: 1 addition & 1 deletion internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ require (
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.20.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
google.golang.org/protobuf v1.36.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
27 changes: 0 additions & 27 deletions linker/linker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3460,33 +3460,6 @@ func TestLinkerValidation(t *testing.T) {
`,
},
},
"failure_editions_ctype_not_string_or_bytes": {
input: map[string]string{
"test.proto": `
edition = "2023";
package foo;
message A {
uint32 s = 1 [ctype=STRING_PIECE];
}
`,
},
expectedErr: `test.proto:4:23: ctype option can only be used on string and bytes fields`,
},
"failure_editions_ctype_ext_cannot_be_cord": {
input: map[string]string{
"test.proto": `
edition = "2023";
package foo;
message A {
extensions 10 to 100;
}
extend A {
string ext = 10 [ctype=CORD];
}
`,
},
expectedErr: `test.proto:7:26: ctype option cannot be CORD for extension fields`,
},
"success_feature_within_lifetime": {
input: map[string]string{
"feature.proto": `
Expand Down
13 changes: 0 additions & 13 deletions linker/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,6 @@ func (r *result) validateField(fld protoreflect.FieldDescriptor, handler *report
if err := handler.HandleErrorf(span, "ctype option cannot be used as of edition 2024; use features.string_type instead"); err != nil {
return err
}
} else if descriptorpb.Edition(r.Edition()) == descriptorpb.Edition_EDITION_2023 {
if fld.Kind() != protoreflect.StringKind && fld.Kind() != protoreflect.BytesKind {
span := r.findOptionSpan(fd, internal.FieldOptionsCTypeTag)
if err := handler.HandleErrorf(span, "ctype option can only be used on string and bytes fields"); err != nil {
return err
}
}
if fd.proto.Options.GetCtype() == descriptorpb.FieldOptions_CORD && fd.IsExtension() {
span := r.findOptionSpan(fd, internal.FieldOptionsCTypeTag)
if err := handler.HandleErrorf(span, "ctype option cannot be CORD for extension fields"); err != nil {
return err
}
}
}
}
if (fd.proto.Options.GetLazy() || fd.proto.Options.GetUnverifiedLazy()) && fd.Kind() != protoreflect.MessageKind {
Expand Down
2 changes: 0 additions & 2 deletions parser/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,6 @@ func TestBasicValidation(t *testing.T) {
option (foo) = -inf;
option (foo) = nan;
option (foo) = -nan;`,
// Bug in protoc, see https://github.com/protocolbuffers/protobuf/issues/15010
expectedDiffWithProtoc: true,
},
"failure_inf_upper_in_option_value": {
contents: `syntax = "proto2";
Expand Down

0 comments on commit 0c5adcf

Please sign in to comment.