diff --git a/content/best-practices/api.md b/content/best-practices/api.md index 0b37d27d8..85f09bf39 100644 --- a/content/best-practices/api.md +++ b/content/best-practices/api.md @@ -124,7 +124,7 @@ The following are exceptions to the rule: opaquely as possible so that you don't create a dependency nexus. Consider using extensions or [Encode Opaque Data in Strings by Web-safe Encoding Binary Proto - Serialization](/programming-guides/api#encode-opaque-data-in-strings). + Serialization](/best-practices/api#encode-opaque-data-in-strings). ## For Mutations, Support Partial Updates or Append-Only Updates, Not Full Replaces {#support-partial-updates} diff --git a/content/editions/overview.md b/content/editions/overview.md index 1be4756c6..c41064284 100644 --- a/content/editions/overview.md +++ b/content/editions/overview.md @@ -237,7 +237,7 @@ features not explicitly set conform to the behavior defined in the edition version used for the .proto file. The following code sample shows some features being set at the file, field, and -enum level. The settings are in the highlighted lines: +enum level. ```proto {highlight="lines:3,7,16"} edition = "2023"; @@ -333,6 +333,5 @@ special wire-format that groups used is still available by using `DELIMITED` message encoding. **Required label.** The `required` label, available only in proto2, is -unavailable in editions. The underlying functionality is still available (but -[discouraged](/programming-guides/required-considered-harmful)) +unavailable in editions. The underlying functionality is still available by using `features.field_presence=LEGACY_REQUIRED`. diff --git a/content/programming-guides/deserialize-debug.md b/content/programming-guides/deserialize-debug.md index 49b05e19c..6e4a75949 100644 --- a/content/programming-guides/deserialize-debug.md +++ b/content/programming-guides/deserialize-debug.md @@ -24,7 +24,7 @@ and a randomized-length whitespace sequence. The new debugging format looks as follows: ```none -goo.gle/nodeserialize +goo.gle/debugstr spii_field: [REDACTED] normal_field: "value" ``` diff --git a/content/programming-guides/proto3.md b/content/programming-guides/proto3.md index 5c7705c45..34d5cb2cb 100644 --- a/content/programming-guides/proto3.md +++ b/content/programming-guides/proto3.md @@ -616,7 +616,7 @@ automatically generated class: string - string + std::string String str/unicode[5] string @@ -628,7 +628,7 @@ automatically generated class: bytes - string + std::string ByteString str (Python 2), bytes (Python 3) []byte diff --git a/content/reference/go/go-generated-opaque.md b/content/reference/go/go-generated-opaque.md index b745a1b59..cb5fd705a 100644 --- a/content/reference/go/go-generated-opaque.md +++ b/content/reference/go/go-generated-opaque.md @@ -210,6 +210,21 @@ which provides a reflection-based view of the message. The `optimize_for` option does not affect the output of the Go code generator. +When multiple goroutines concurrently access the same message, the following +rules apply: + +* Accessing (reading) fields concurrently is safe, with one exception: + * Accessing a [lazy field](https://github.com/protocolbuffers/protobuf/blob/cacb096002994000f8ccc6d9b8e1b5b0783ee561/src/google/protobuf/descriptor.proto#L609) + for the first time is a modification. +* Modifying different fields in the same message is safe. +* Modifying a field concurrently is not safe. +* Modifying a message in any way concurrently with functions of the + [`proto` package](https://pkg.go.dev/google.golang.org/protobuf/proto?tab=doc), + such as + [`proto.Marshal`](https://pkg.go.dev/google.golang.org/protobuf/proto#Marshal) + or [`proto.Size`](https://pkg.go.dev/google.golang.org/protobuf/proto#Size) + is not safe. + ### Nested Types A message can be declared inside another message. For example: diff --git a/content/reference/go/go-generated.md b/content/reference/go/go-generated.md index 3d1b5dc45..07592dc8f 100644 --- a/content/reference/go/go-generated.md +++ b/content/reference/go/go-generated.md @@ -209,6 +209,21 @@ which provides a reflection-based view of the message. The `optimize_for` option does not affect the output of the Go code generator. +When multiple goroutines concurrently access the same message, the following +rules apply: + +* Accessing (reading) fields concurrently is safe, with one exception: + * Accessing a [lazy field](https://github.com/protocolbuffers/protobuf/blob/cacb096002994000f8ccc6d9b8e1b5b0783ee561/src/google/protobuf/descriptor.proto#L609) + for the first time is a modification. +* Modifying different fields in the same message is safe. +* Modifying a field concurrently is not safe. +* Modifying a message in any way concurrently with functions of the + [`proto` package](https://pkg.go.dev/google.golang.org/protobuf/proto?tab=doc), + such as + [`proto.Marshal`](https://pkg.go.dev/google.golang.org/protobuf/proto#Marshal) + or [`proto.Size`](https://pkg.go.dev/google.golang.org/protobuf/proto#Size) + is not safe. + ### Nested Types A message can be declared inside another message. For example: