Skip to content

Commit

Permalink
all: update descriptor.proto to latest version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
neild committed Mar 5, 2024
1 parent 5d5e8c0 commit b7697bb
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x]
go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -15,8 +15,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: TestLatest
if: matrix.go-version == '1.16.x'
if: matrix.go-version == '1.21.x'
run: ./test.bash
- name: TestAll
if: matrix.go-version != '1.16.x'
if: matrix.go-version != '1.21.x'
run: go test ./...
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Deprecated: Use the "google.golang.org/protobuf" module instead.
module github.com/golang/protobuf

go 1.9
go 1.17

require (
github.com/google/go-cmp v0.5.5
google.golang.org/protobuf v1.26.0
google.golang.org/protobuf v1.33.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
1 change: 1 addition & 0 deletions jsonpb/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Unmarshaler struct {
// implement JSONPBMarshaler so that the custom format can be produced.
//
// The JSON unmarshaling must follow the JSON to proto specification:
//
// https://developers.google.com/protocol-buffers/docs/proto3#json
//
// Deprecated: Custom types should implement protobuf reflection instead.
Expand Down
1 change: 1 addition & 0 deletions jsonpb/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type Marshaler struct {
// implement JSONPBUnmarshaler so that the custom format can be parsed.
//
// The JSON marshaling must follow the proto to JSON specification:
//
// https://developers.google.com/protocol-buffers/docs/proto3#json
//
// Deprecated: Custom types should implement protobuf reflection instead.
Expand Down
128 changes: 126 additions & 2 deletions protoc-gen-go/descriptor/descriptor.pb.go

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

2 changes: 2 additions & 0 deletions protoc-gen-go/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,7 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) {
// The tag is a string like "varint,2,opt,name=fieldname,def=7" that
// identifies details of the field for the protocol buffer marshaling and unmarshaling
// code. The fields are:
//
// wire encoding
// protocol tag number
// opt,req,rep for optional, required, or repeated
Expand All @@ -1442,6 +1443,7 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) {
// enum= the name of the enum type if it is an enum-typed field.
// proto3 if this field is in a proto3 message
// def= string representation of the default value, if any.
//
// The default value must be in a representation that can be used at run-time
// to generate the default value. Thus bools become 0 and 1, for instance.
func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string {
Expand Down
4 changes: 4 additions & 0 deletions protoc-gen-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate
// Go code. Install it by building this program and making it accessible within
// your PATH with the name:
//
// protoc-gen-go
//
// The 'go' suffix becomes part of the argument for the protocol compiler,
// such that it can be invoked as:
//
// protoc --go_out=paths=source_relative:. path/to/file.proto
//
// This generates Go bindings for the protocol buffer defined by file.proto.
// With that input, the output will be written to:
//
// path/to/file.pb.go
//
// See the README and documentation for protocol buffers to learn more:
//
// https://developers.google.com/protocol-buffers/
package main

Expand Down
1 change: 1 addition & 0 deletions protoc-gen-go/plugin/plugin.pb.go

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

7 changes: 4 additions & 3 deletions ptypes/any.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool {
// The allocated message is stored in the embedded proto.Message.
//
// Example:
// var x ptypes.DynamicAny
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
// fmt.Printf("unmarshaled message: %v", x.Message)
//
// var x ptypes.DynamicAny
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
// fmt.Printf("unmarshaled message: %v", x.Message)
//
// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
// the any message contents into a new instance of the underlying message.
Expand Down

0 comments on commit b7697bb

Please sign in to comment.