Commit Graph

6 Commits

Author SHA1 Message Date
Michael Stapelberg
013dd178dc all: drop unnecessary import renames for consistency
Most of our imports already comply with the style, but this change makes it
consistent across the entire repository.

I suspect that these unnecessary imports are left-overs from differences between
Google-internal (where many imports are renamed) and Open Source.

Change-Id: Id5f6eabd22bcc72dd4e36dd018b6cc5138df7696
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/609875
Reviewed-by: Christian Höppner <hoeppi@google.com>
Auto-Submit: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-30 09:35:51 +00:00
Michael Stapelberg
cbc3dd69c1 all: replace interface{} by any now that we are on Go 1.21
I generated this change using:

  % sed -i 's,interface{},any,g' **/*.go
  % git checkout -- **/*.pb.go
  % $EDITOR cmd/protoc-gen-go/internal_gengo/well_known_types.go
  % ./regenerate.bash

Change-Id: I728f4b69c87ffc8f3b19bf807bf9bf1479bdbab4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/585735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2024-05-15 12:42:15 +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
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
sryoya
0e358a402f reflect/protorange: fix typo of func name in comment
Change-Id: I80ffc34e29757e0cbdccdd530404fa215cfaf75f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/317989
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-05-07 17:05:00 +00:00
Joe Tsai
e4fcb9f7e7 reflect: add protopath and protorange packages
The protopath package provides a means to programmatically represent
a sequence of protobuf reflection operations.
The protorange package traverses through a message and
calls a user-provided function as it iterates.

This feature sets the groundwork for the often requested feature
of being able to exclude certain fields when merging or serializing.

package protopath
    type Path []Step
    type Step struct{ ... }
        func Root(protoreflect.MessageDescriptor) Step
        func FieldAccess(protoreflect.FieldDescriptor) Step
        func UnknownAccess() Step
        func ListIndex(int) Step
        func MapIndex(protoreflect.MapKey) Step
        func AnyExpand(protoreflect.MessageDescriptor) Step
        func (Step) Kind() StepKind
        func (Step) FieldDescriptor() protoreflect.FieldDescriptor
        func (Step) MessageDescriptor() protoreflect.MessageDescriptor
        func (Step) ListIndex() int
        func (Step) MapIndex() protoreflect.MapKey
        func (Step) String() string
    type StepKind int
        const RootStep StepKind
        const FieldAccessStep StepKind
        const UnknownAccessStep StepKind
        const ListIndexStep StepKind
        const MapIndexStep StepKind
        const AnyExpandStep StepKind
    type Values struct {
        Path   Path
        Values []protoreflect.Value
    }
    func (Values) Index(int) (out struct{ ... })
    func (Values) Len() int
    func (Values) String() string

package protorange
    var Break error
    var Terminate error
    func Range(protoreflect.Message, func(protopath.Values) error) error
    type Options struct {
        Stable bool
        Resolver interface { ... }
    }
    func (Options) Range(m protoreflect.Message, push, pop func(protopath.Values) error) error

Change-Id: I29cbd5142fe169d78367d54a95d37801888b64f4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/236540
Trust: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Damien Neil <dneil@google.com>
2021-04-01 23:09:19 +00:00